B - the builder type parameter.C - the resulting connection configuration type parameter.public abstract static class ConnectionConfiguration.Builder<B extends ConnectionConfiguration.Builder<B,C>,C extends ConnectionConfiguration>
extends java.lang.Object
This is an abstract class that uses the builder design pattern and the "getThis() trick" to recover the type of the builder in a class hierarchies with a self-referential generic supertype. Otherwise chaining of build instructions from the superclasses followed by build instructions of a sublcass would not be possible, because the superclass build instructions would return the builder of the superclass and not the one of the subclass. You can read more about it a Angelika Langer's Generics FAQ, especially the entry What is the "getThis()" trick?.
| Modifier | Constructor and Description |
|---|---|
protected |
Builder() |
| Modifier and Type | Method and Description |
|---|---|
B |
addEnabledSaslMechanism(java.util.Collection<java.lang.String> saslMechanisms)
Enable the given SASL mechanisms.
|
B |
addEnabledSaslMechanism(java.lang.String saslMechanism)
Add the given mechanism to the enabled ones.
|
B |
allowEmptyOrNullUsernames()
Allow
null or the empty String as username. |
abstract C |
build() |
protected abstract B |
getThis() |
B |
performSaslAnonymousAuthentication()
Perform anonymous authentication using SASL ANONYMOUS.
|
B |
performSaslExternalAuthentication(javax.net.ssl.SSLContext sslContext)
Perform authentication using SASL EXTERNAL.
|
B |
setAuthzid(org.jxmpp.jid.EntityBareJid authzid)
Set the XMPP address to be used as authorization identity.
|
B |
setCallbackHandler(javax.security.auth.callback.CallbackHandler callbackHandler)
Sets a CallbackHandler to obtain information, such as the password or
principal information during the SASL authentication.
|
B |
setCustomSSLContext(javax.net.ssl.SSLContext context)
Sets a custom SSLContext for creating SSL sockets.
|
B |
setDebuggerEnabled(boolean debuggerEnabled)
Sets if the new connection about to be establish is going to be debugged.
|
B |
setEnabledSSLCiphers(java.lang.String[] enabledSSLCiphers)
Set the enabled SSL/TLS ciphers.
|
B |
setEnabledSSLProtocols(java.lang.String[] enabledSSLProtocols)
Set the enabled SSL/TLS protocols.
|
B |
setHost(java.lang.String host) |
B |
setHostnameVerifier(javax.net.ssl.HostnameVerifier verifier)
Set the HostnameVerifier used to verify the hostname of SSLSockets used by XMPP connections
created with this ConnectionConfiguration.
|
B |
setKeystorePath(java.lang.String keystorePath)
Sets the path to the keystore file.
|
B |
setKeystoreType(java.lang.String keystoreType)
Sets the keystore type.
|
B |
setLegacySessionDisabled(boolean legacySessionDisabled)
Deprecated.
Smack processes the 'optional' element of the session stream feature.
|
B |
setPKCS11Library(java.lang.String pkcs11Library)
Sets the PKCS11 library file location, needed when the
Keystore type is PKCS11.
|
B |
setPort(int port) |
B |
setProxyInfo(ProxyInfo proxyInfo)
Set the information about the Proxy used for the connection.
|
B |
setResource(java.lang.CharSequence resource)
Set the resource to use.
|
B |
setResource(org.jxmpp.jid.parts.Resourcepart resource)
Set the resource to use.
|
B |
setSecurityMode(ConnectionConfiguration.SecurityMode securityMode)
Sets the TLS security mode used when making the connection.
|
B |
setSendPresence(boolean sendPresence)
Sets if an initial available presence will be sent to the server.
|
B |
setServiceName(org.jxmpp.jid.DomainBareJid serviceName)
Deprecated.
use
setXmppDomain(DomainBareJid) instead. |
B |
setSocketFactory(javax.net.SocketFactory socketFactory)
Sets the socket factory used to create new xmppConnection sockets.
|
B |
setUsernameAndPassword(java.lang.CharSequence username,
java.lang.String password)
Set the XMPP entities username and password.
|
B |
setXmppDomain(org.jxmpp.jid.DomainBareJid xmppServiceDomain)
Set the service name of this XMPP service (i.e., the XMPP domain).
|
public B setUsernameAndPassword(java.lang.CharSequence username, java.lang.String password)
The username is usually the localpart of the clients JID. But some SASL mechanisms or services may require a different format (e.g. the full JID) as used authorization identity.
username - the username or authorization identitypassword - the password or token used to authenticate@Deprecated public B setServiceName(org.jxmpp.jid.DomainBareJid serviceName)
setXmppDomain(DomainBareJid) instead.serviceName - the service namepublic B setXmppDomain(org.jxmpp.jid.DomainBareJid xmppServiceDomain)
xmppServiceDomain - the service namepublic B setResource(org.jxmpp.jid.parts.Resourcepart resource)
If resource is null, then the server will automatically create a resource for the
client. Default resource is "Smack".
resource - the resource to use.public B setResource(java.lang.CharSequence resource) throws org.jxmpp.stringprep.XmppStringprepException
resource - the non-null CharSequence to use a resource.org.jxmpp.stringprep.XmppStringprepException - if the CharSequence is not a valid resourcepart.setResource(Resourcepart)public B setHost(java.lang.String host)
public B setPort(int port)
public B setCallbackHandler(javax.security.auth.callback.CallbackHandler callbackHandler)
callbackHandler - to obtain information, such as the password or
principal information during the SASL authentication.public B setSecurityMode(ConnectionConfiguration.SecurityMode securityMode)
ConnectionConfiguration.SecurityMode.ifpossible.securityMode - the security mode.public B setKeystorePath(java.lang.String keystorePath)
keystorePath - the path to the keystore file.public B setKeystoreType(java.lang.String keystoreType)
keystoreType - the keystore type.public B setPKCS11Library(java.lang.String pkcs11Library)
pkcs11Library - the path to the PKCS11 library file.public B setCustomSSLContext(javax.net.ssl.SSLContext context)
For more information on how to create a SSLContext see Java Secure Socket Extension (JSEE) Reference Guide: Creating Your Own X509TrustManager
context - the custom SSLContext for new sockets.public B setEnabledSSLProtocols(java.lang.String[] enabledSSLProtocols)
enabledSSLProtocols - public B setEnabledSSLCiphers(java.lang.String[] enabledSSLCiphers)
enabledSSLCiphers - the enabled SSL/TLS cipherspublic B setHostnameVerifier(javax.net.ssl.HostnameVerifier verifier)
verifier - @Deprecated public B setLegacySessionDisabled(boolean legacySessionDisabled)
Session will be requested on login if the server supports
it. Although this was mandatory on RFC 3921, RFC 6120/6121 don't even
mention this part of the protocol.
Deprecation notice: This setting is no longer required in most cases because Smack processes the 'optional' element eventually found in the session stream feature. See also Here Lies Extensible Messaging and Presence Protocol (XMPP) Session Establishment
legacySessionDisabled - if a session has to be requested when logging in.public B setSendPresence(boolean sendPresence)
sendPresence - true if an initial available presence will be sent while logging in.public B setDebuggerEnabled(boolean debuggerEnabled)
SmackConfiguration.DEBUG is used.debuggerEnabled - if the new connection about to be establish is going to be debugged.public B setSocketFactory(javax.net.SocketFactory socketFactory)
socketFactory - used to create new sockets.public B setProxyInfo(ProxyInfo proxyInfo)
proxyInfo - the Proxy information.public B allowEmptyOrNullUsernames()
null or the empty String as username.
Some SASL mechanisms (e.g. SASL External) may also signal the username (as "authorization identity"), in
which case Smack should not throw an IllegalArgumentException when the username is not set.public B performSaslAnonymousAuthentication()
addEnabledSaslMechanism(String) with "ANONYMOUS" as argument.public B performSaslExternalAuthentication(javax.net.ssl.SSLContext sslContext)
addEnabledSaslMechanism(String) with "EXTERNAL" as
argument. It also calls allowEmptyOrNullUsernames() and setSecurityMode(ConnectionConfiguration.SecurityMode) to
ConnectionConfiguration.SecurityMode.required.public B addEnabledSaslMechanism(java.lang.String saslMechanism)
addEnabledSaslMechanism(Collection) for a discussion about enabled SASL mechanisms.saslMechanism - the name of the mechanism to enable.public B addEnabledSaslMechanism(java.util.Collection<java.lang.String> saslMechanisms)
saslMechanisms - a collection of names of mechanisms to enable.public B setAuthzid(org.jxmpp.jid.EntityBareJid authzid)
In XMPP, authorization identities are bare jids. In general, callers should allow the server to select the authorization identifier automatically, and not call this. Note that setting the authzid does not set the XMPP service domain, which should typically match. Calling this will also SASL CRAM, since this mechanism does not support authzid.
authzid - The BareJid to be requested as the authorization identifier.public abstract C build()
protected abstract B getThis()