Package org.igniterealtime.jbosh
Class BOSHClientConfig.Builder
- java.lang.Object
-
- org.igniterealtime.jbosh.BOSHClientConfig.Builder
-
- Enclosing class:
- BOSHClientConfig
public static final class BOSHClientConfig.Builder extends java.lang.Object
Class instance builder, after the builder pattern. This allows eachBOSHClientConfig
instance to be immutable while providing flexibility when building newBOSHClientConfig
instances. Instances of this class are not thread-safe. If template-style use is desired, see thecreate(BOSHClientConfig)
method.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Boolean
bCompression
private java.lang.String
bDomain
private java.lang.String
bFrom
private java.lang.String
bLang
private java.lang.String
bProxyHost
private int
bProxyPort
private java.lang.String
bRoute
private javax.net.ssl.SSLContext
bSSLContext
private java.net.URI
bURI
-
Constructor Summary
Constructors Modifier Constructor Description private
Builder(java.net.URI cmURI, java.lang.String domain)
Creates a new builder instance, used to create instances of theBOSHClientConfig
class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BOSHClientConfig
build()
Build the immutable object instance with the current configuration.static BOSHClientConfig.Builder
create(java.net.URI cmURI, java.lang.String domain)
Creates a new builder instance, used to create instances of theBOSHClientConfig
class.static BOSHClientConfig.Builder
create(BOSHClientConfig cfg)
Creates a new builder instance using the existing configuration provided as a starting point.BOSHClientConfig.Builder
setCompressionEnabled(boolean enabled)
Set whether or not compression of the underlying data stream should be attempted.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.BOSHClientConfig.Builder
setProxy(java.lang.String hostName, int port)
Specify the hostname and port of an HTTP proxy to connect through.BOSHClientConfig.Builder
setRoute(java.lang.String protocol, java.lang.String host, int port)
Sets the destination server/domain that the client should connect to.BOSHClientConfig.Builder
setSSLContext(javax.net.ssl.SSLContext ctx)
Set the SSL context to use for this session.BOSHClientConfig.Builder
setXMLLang(java.lang.String lang)
Set the default language of any human-readable content within the XML.
-
-
-
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
-
-
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 theBOSHClientConfig
class.- Parameters:
cmURI
- URI to use to contact the connection managerdomain
- 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 hostnameport
- 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 totrue
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
-
-