Package org.jivesoftware.openfire.net
Class Bind2Request
java.lang.Object
org.jivesoftware.openfire.net.Bind2Request
Represents a SASL2 bind2 request from a client.
The bind request contains an optional tag identifying the client software
and can include additional feature requests in other namespaces.
-
Constructor Summary
ConstructorsConstructorDescriptionBind2Request(String clientTag, List<org.dom4j.Element> featureRequests) Creates a new Bind2Request instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.dom4j.Elementstatic Bind2Requestfrom(org.dom4j.Element authenticateElement) Extracts bind information from a SASL2 authenticate element.generateResourceString(UserAgentInfo userAgentInfo) Generates a resource string using the user agent information or defaults.Gets the client software identifier tag.List<org.dom4j.Element>Gets the list of feature request elements.org.dom4j.ElementprocessFeatureRequests(LocalClientSession clientSession, org.dom4j.Element successElement) Process feature request elements using registered handlers.static voidregisterElementHandler(Bind2InlineHandler handler) Registers a handler for processing inline elements with a specific namespace.static booleanUnregisters an inline element handler associated with a specific namespace.
-
Constructor Details
-
Bind2Request
Creates a new Bind2Request instance.- Parameters:
clientTag- Optional string identifying the client software, can be null.featureRequests- List of feature request elements, can be empty but not null.
-
-
Method Details
-
registerElementHandler
Registers a handler for processing inline elements with a specific namespace. Only one handler can be registered for each namespace. Attempting to register a handler for an already registered namespace will result in an IllegalStateException.- Parameters:
handler- The handler to register
-
unregisterElementHandler
Unregisters an inline element handler associated with a specific namespace. This method removes a registration using handler equality, not just namespace matching. As a result, an invocation must retain the exact handler instance they registered. If no handler is registered for the given namespace or if the provided handler does not match the currently registered handler, no action will be performed.- Parameters:
handler- The inline element handler to unregister. Must not be null and must provide a valid namespace.- Returns:
trueif the handler was successfully unregistered,falseotherwise.- Throws:
IllegalArgumentException- if the handler's namespace isnullor empty.
-
processFeatureRequests
public org.dom4j.Element processFeatureRequests(LocalClientSession clientSession, org.dom4j.Element successElement) Process feature request elements using registered handlers.- Returns:
- Element for
-
featureElement
public static org.dom4j.Element featureElement() -
from
Extracts bind information from a SASL2 authenticate element.- Parameters:
authenticateElement- The authenticate element from which to extract bind data.- Returns:
- A Bind2Request instance containing the extracted data, or null if no bind element was found.
-
getClientTag
Gets the client software identifier tag.- Returns:
- The client tag or null if none was provided.
-
getFeatureRequests
Gets the list of feature request elements.- Returns:
- An unmodifiable list of feature request elements.
-
generateResourceString
Generates a resource string using the user agent information or defaults.- Parameters:
userAgentInfo- The user agent information, can be null- Returns:
- A resource string containing the client tag (if provided) followed by random string (hex or UUID).
-