Class Bind2Request

java.lang.Object
org.jivesoftware.openfire.net.Bind2Request

public class Bind2Request extends Object
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 Details

    • Bind2Request

      public Bind2Request(String clientTag, List<org.dom4j.Element> featureRequests)
      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

      public static void registerElementHandler(@Nonnull Bind2InlineHandler handler)
      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

      public static boolean unregisterElementHandler(@Nonnull Bind2InlineHandler handler)
      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:
      true if the handler was successfully unregistered, false otherwise.
      Throws:
      IllegalArgumentException - if the handler's namespace is null or 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

      public static Bind2Request from(org.dom4j.Element authenticateElement)
      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

      public String getClientTag()
      Gets the client software identifier tag.
      Returns:
      The client tag or null if none was provided.
    • getFeatureRequests

      public List<org.dom4j.Element> getFeatureRequests()
      Gets the list of feature request elements.
      Returns:
      An unmodifiable list of feature request elements.
    • generateResourceString

      public String generateResourceString(UserAgentInfo userAgentInfo)
      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).