Class BOSHClientConfig.Builder

  • Enclosing class:
    BOSHClientConfig

    public static final class BOSHClientConfig.Builder
    extends java.lang.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 Detail

      • bURI

        private final java.net.URI bURI
      • bDomain

        private final java.lang.String bDomain
      • bFrom

        private java.lang.String bFrom
      • bLang

        private java.lang.String bLang
      • bRoute

        private java.lang.String bRoute
      • bProxyHost

        private java.lang.String bProxyHost
      • bProxyPort

        private int bProxyPort
      • bSSLContext

        private javax.net.ssl.SSLContext bSSLContext
      • bCompression

        private java.lang.Boolean bCompression
    • Constructor Detail

      • Builder

        private Builder​(java.net.URI cmURI,
                        java.lang.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 Detail

      • create

        public static BOSHClientConfig.Builder create​(java.net.URI cmURI,
                                                      java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String protocol,
                                                 java.lang.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​(java.lang.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​(javax.net.ssl.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