Class Bind2StreamManagementHandler
java.lang.Object
org.jivesoftware.openfire.handler.Bind2StreamManagementHandler
- All Implemented Interfaces:
Bind2InlineHandler
A
Bind2InlineHandler that processes XEP-0198 Stream Management <enable/> elements
sent inline within a SASL2 Bind2 request (XEP-0388 / XEP-0386).
When a client includes an <enable/> element in the urn:xmpp:sm:3 namespace
inside its Bind2 <bind/> element, this handler delegates to the session's
StreamManager to enable stream management (and optionally resumption) immediately
after resource binding, without requiring a separate round-trip.
The <enabled/> response from the server is added as a child of the <bound/>
element in the SASL2 <success/> stanza.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the namespace this handler processes.booleanhandleElement(LocalClientSession session, org.dom4j.Element bound, org.dom4j.Element element) Handles an<enable/>element from a Bind2 inline feature request by enabling XEP-0198 stream management on the session.voidhandleFailure(LocalClientSession session, org.dom4j.Element bound, org.dom4j.Element element, Exception cause) Adds the<failed/>element that XEP-0198 § 9.1.1 requires inside<bound/>when stream management could not be enabled.booleanIndicates whether this handler is currently available for advertisement and request processing.
-
Constructor Details
-
Bind2StreamManagementHandler
public Bind2StreamManagementHandler()
-
-
Method Details
-
getNamespace
Description copied from interface:Bind2InlineHandlerGets the namespace this handler processes.- Specified by:
getNamespacein interfaceBind2InlineHandler- Returns:
- The XML namespace URI this handler supports
-
isEnabled
public boolean isEnabled()Description copied from interface:Bind2InlineHandlerIndicates whether this handler is currently available for advertisement and request processing. A handler whose feature is disabled by configuration is neither advertised in the Bind2 inline feature list nor invoked for a request that names its namespace, so that a peer is never offered something it cannot use.- Specified by:
isEnabledin interfaceBind2InlineHandler- Returns:
truewhen the inline feature is available
-
handleElement
public boolean handleElement(LocalClientSession session, org.dom4j.Element bound, org.dom4j.Element element) Handles an<enable/>element from a Bind2 inline feature request by enabling XEP-0198 stream management on the session. The<enabled/>response element produced by the stream manager is added as a child of the providedboundelement.Only
<enable/>elements are processed; any other element name is ignored.- Specified by:
handleElementin interfaceBind2InlineHandler- Parameters:
session- the client session on which stream management should be enabledbound- the<bound/>element to which the<enabled/>response is addedelement- the inline element from the Bind2 request (expected to be<enable/>)- Returns:
trueif the element was an<enable/>and was processed;falseif the element was not an<enable/>or processing failed
-
handleFailure
public void handleFailure(LocalClientSession session, org.dom4j.Element bound, org.dom4j.Element element, Exception cause) Adds the<failed/>element that XEP-0198 § 9.1.1 requires inside<bound/>when stream management could not be enabled. The condition is taken from the failure itself where one is available. A handler that declined the request without failing did so because the element was not an<enable/>, which is a malformed request.- Specified by:
handleFailurein interfaceBind2InlineHandler- Parameters:
session- the client sessionbound- the Bind2 response elementelement- the request that could not be processedcause- the processing exception, ornullwhen the handler returnedfalse
-