Class BOSHClientConfig.Builder

java.lang.Object
org.igniterealtime.jbosh.BOSHClientConfig.Builder
Enclosing class:
BOSHClientConfig

public static final class BOSHClientConfig.Builder extends Object
Class instance builder, after the builder pattern. This allows each BOSHClientConfig instance to be immutable while providing flexibility when building new BOSHClientConfig instances.

Instances of this class are not thread-safe. If template-style use is desired, see the create(BOSHClientConfig) method.

  • Field Details

    • bURI

      private final URI bURI
    • bDomain

      private final String bDomain
    • bFrom

      private String bFrom
    • bLang

      private String bLang
    • bRoute

      private String bRoute
    • bProxyHost

      private String bProxyHost
    • bProxyPort

      private int bProxyPort
    • bSSLContext

      private SSLContext bSSLContext
    • bCompression

      private Boolean bCompression
  • Constructor Details

    • Builder

      private Builder(URI cmURI, String domain)
      Creates a new builder instance, used to create instances of the BOSHClientConfig class.
      Parameters:
      cmURI - URI to use to contact the connection manager
      domain - target domain to communicate with
  • Method Details

    • create

      public static BOSHClientConfig.Builder create(URI cmURI, String domain)
      Creates a new builder instance, used to create instances of the BOSHClientConfig class.
      Parameters:
      cmURI - URI to use to contact the connection manager
      domain - target domain to communicate with
      Returns:
      builder instance
    • create

      public static BOSHClientConfig.Builder create(BOSHClientConfig cfg)
      Creates a new builder instance using the existing configuration provided as a starting point.
      Parameters:
      cfg - configuration to copy
      Returns:
      builder instance
    • setFrom

      public BOSHClientConfig.Builder setFrom(String id)
      Set the ID of the client station, to be forwarded to the connection manager when new sessions are created.
      Parameters:
      id - client ID
      Returns:
      builder instance
    • setXMLLang

      public BOSHClientConfig.Builder setXMLLang(String lang)
      Set the default language of any human-readable content within the XML.
      Parameters:
      lang - XML language ID
      Returns:
      builder instance
    • setRoute

      public BOSHClientConfig.Builder setRoute(String protocol, String host, int port)
      Sets the destination server/domain that the client should connect to. Connection managers may be configured to enable sessions with more that one server in different domains. When requesting a session with such a "proxy" connection manager, a client should use this method to specify the server with which it wants to communicate.
      Parameters:
      protocol - connection protocol (e.g, "xmpp")
      host - host or domain to be served by the remote server. Note that this is not necessarily the host name or domain name of the remote server.
      port - port number of the remote server
      Returns:
      builder instance
    • setProxy

      public BOSHClientConfig.Builder setProxy(String hostName, int port)
      Specify the hostname and port of an HTTP proxy to connect through.
      Parameters:
      hostName - proxy hostname
      port - proxy port number
      Returns:
      builder instance
    • setSSLContext

      public BOSHClientConfig.Builder setSSLContext(SSLContext ctx)
      Set the SSL context to use for this session. This can be used to configure certificate-based authentication, etc..
      Parameters:
      ctx - SSL context
      Returns:
      builder instance
    • setCompressionEnabled

      public BOSHClientConfig.Builder setCompressionEnabled(boolean enabled)
      Set whether or not compression of the underlying data stream should be attempted. By default, compression is disabled.
      Parameters:
      enabled - set to true if compression should be attempted when possible, false to disable compression
      Returns:
      builder instance
    • build

      public BOSHClientConfig build()
      Build the immutable object instance with the current configuration.
      Returns:
      BOSHClientConfig instance