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.ObjectClass instance builder, after the builder pattern. This allows eachBOSHClientConfiginstance to be immutable while providing flexibility when building newBOSHClientConfiginstances. 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.BooleanbCompressionprivate java.lang.StringbDomainprivate java.lang.StringbFromprivate java.lang.StringbLangprivate java.lang.StringbProxyHostprivate intbProxyPortprivate java.lang.StringbRouteprivate javax.net.ssl.SSLContextbSSLContextprivate java.net.URIbURI
-
Constructor Summary
Constructors Modifier Constructor Description privateBuilder(java.net.URI cmURI, java.lang.String domain)Creates a new builder instance, used to create instances of theBOSHClientConfigclass.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BOSHClientConfigbuild()Build the immutable object instance with the current configuration.static BOSHClientConfig.Buildercreate(java.net.URI cmURI, java.lang.String domain)Creates a new builder instance, used to create instances of theBOSHClientConfigclass.static BOSHClientConfig.Buildercreate(BOSHClientConfig cfg)Creates a new builder instance using the existing configuration provided as a starting point.BOSHClientConfig.BuildersetCompressionEnabled(boolean enabled)Set whether or not compression of the underlying data stream should be attempted.BOSHClientConfig.BuildersetFrom(java.lang.String id)Set the ID of the client station, to be forwarded to the connection manager when new sessions are created.BOSHClientConfig.BuildersetProxy(java.lang.String hostName, int port)Specify the hostname and port of an HTTP proxy to connect through.BOSHClientConfig.BuildersetRoute(java.lang.String protocol, java.lang.String host, int port)Sets the destination server/domain that the client should connect to.BOSHClientConfig.BuildersetSSLContext(javax.net.ssl.SSLContext ctx)Set the SSL context to use for this session.BOSHClientConfig.BuildersetXMLLang(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 theBOSHClientConfigclass.- 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 totrueif compression should be attempted when possible,falseto disable compression- Returns:
- builder instance
-
build
public BOSHClientConfig build()
Build the immutable object instance with the current configuration.- Returns:
- BOSHClientConfig instance
-
-