@Mutable @ThreadSafety(level=NOT_THREADSAFE) public final class LDAPListenerConfig extends java.lang.Object
LDAPListener
instance. Note that while instances of this class are
not inherently threadsafe, a private copy of the configuration will be
created whenever a new LDAPListener
is created so that this
configuration may continue to be altered for new instances without impacting
any existing listeners.Constructor and Description |
---|
LDAPListenerConfig(int listenPort,
LDAPListenerRequestHandler requestHandler)
Creates a new listener configuration.
|
Modifier and Type | Method and Description |
---|---|
LDAPListenerConfig |
duplicate()
Creates a copy of this configuration that may be altered without impacting
this configuration, and which will not be altered by changes to this
configuration.
|
LDAPListenerExceptionHandler |
getExceptionHandler()
Retrieves the exception handler that should be notified of any exceptions
caught while attempting to accept or interact with a client connection.
|
int |
getLingerTimeoutSeconds()
Retrieves the timeout in seconds that should be used if the SO_LINGER
socket option is enabled.
|
java.net.InetAddress |
getListenAddress()
Retrieves the address on which to listen for client connections, if
defined.
|
int |
getListenPort()
Retrieves the port number on which to listen for client connections.
|
int |
getMaxConnections()
Retrieves the maximum number of concurrent connections that the listener
will allow.
|
int |
getMaxMessageSizeBytes()
Retrieves the maximum size in bytes for LDAP messages that will be accepted
by this listener.
|
int |
getReceiveBufferSize()
Retrieves the receive buffer size that should be used for sockets accepted
by the listener.
|
LDAPListenerRequestHandler |
getRequestHandler()
Retrieves the LDAP listener request handler that should be used to process
requests read from clients.
|
int |
getSendBufferSize()
Retrieves the send buffer size that should be used for sockets accepted
by the listener.
|
javax.net.ServerSocketFactory |
getServerSocketFactory()
Retrieves the factory that will be used to create the server socket that
will listen for client connections.
|
boolean |
requestClientCertificate()
Indicates whether the listener should request that the client present its
own certificate chain during TLS negotiation.
|
boolean |
requireClientCertificate()
Indicates whether the listener should require that the client present its
own certificate chain during TLS negotiation and should fail negotiation
if no certificate chain was provided.
|
void |
setExceptionHandler(LDAPListenerExceptionHandler exceptionHandler)
Specifies the exception handler that should be notified of any exceptions
caught while attempting to accept or interact with a client connection.
|
void |
setLingerTimeoutSeconds(int lingerTimeout)
Specifies the timeout in seconds that should be used if the SO_LINGER
socket option is enabled.
|
void |
setListenAddress(java.net.InetAddress listenAddress)
Specifies the address on which to listen for client connections.
|
void |
setListenPort(int listenPort)
Specifies the port number on which to listen for client connections.
|
void |
setMaxConnections(int maxConnections)
Specifies the maximum number of concurrent connections that the listener
will allow.
|
void |
setMaxMessageSizeBytes(int maxMessageSizeBytes)
Specifies the maximum size in bytes for LDAP messages that will be accepted
by this listener.
|
void |
setReceiveBufferSize(int receiveBufferSize)
Specifies the receive buffer size that should be used for sockets accepted
by the listener.
|
void |
setRequestClientCertificate(boolean requestClientCertificate)
Specifies whether the listener should request that the client present its
own certificate chain during TLS negotiation.
|
void |
setRequestHandler(LDAPListenerRequestHandler requestHandler)
Specifies the LDAP listener request handler that should be used to process
requests read from clients.
|
void |
setRequireClientCertificate(boolean requireClientCertificate)
Specifies whether the listener should require that the client present its
own certificate chain during TLS negotiation and should fail negotiation
if no certificate chain was provided.
|
void |
setSendBufferSize(int sendBufferSize)
Specifies the send buffer size that should be used for sockets accepted by
the listener.
|
void |
setServerSocketFactory(javax.net.ServerSocketFactory serverSocketFactory)
Specifies the factory that will be used to create the server socket that
will listen for client connections.
|
void |
setUseKeepAlive(boolean useKeepAlive)
Specifies whether to use the SO_KEEPALIVE socket option for sockets
accepted by the listener.
|
void |
setUseLinger(boolean useLinger)
Specifies whether to use the SO_LINGER socket option for sockets accepted
by the listener.
|
void |
setUseReuseAddress(boolean useReuseAddress)
Specifies whether to use the SO_REUSEADDR socket option for sockets
accepted by the listener.
|
void |
setUseTCPNoDelay(boolean useTCPNoDelay)
Specifies whether to use the TCP_NODELAY socket option for sockets accepted
by the listener.
|
java.lang.String |
toString()
Retrieves a string representation of this LDAP listener config.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP listener config to the
provided buffer.
|
boolean |
useKeepAlive()
Indicates whether to use the SO_KEEPALIVE socket option for sockets
accepted by the listener.
|
boolean |
useLinger()
Indicates whether to use the SO_LINGER socket option for sockets accepted
by the listener.
|
boolean |
useReuseAddress()
Indicates whether to use the SO_REUSEADDR socket option for sockets
accepted by the listener.
|
boolean |
useTCPNoDelay()
Indicates whether to use the TCP_NODELAY socket option for sockets accepted
by the listener.
|
public LDAPListenerConfig(int listenPort, @NotNull LDAPListenerRequestHandler requestHandler)
listenPort
- The port on which to listen for client connections.
It must be an integer between 1 and 65535, or 0 to
indicate that a free port should be chosen by the
JVM.requestHandler
- The request handler that will be used to process
requests read from clients. It must not be
null
.public int getListenPort()
public void setListenPort(int listenPort)
listenPort
- The port number on which to listen for client
connections.@NotNull public LDAPListenerRequestHandler getRequestHandler()
public void setRequestHandler(@NotNull LDAPListenerRequestHandler requestHandler)
requestHandler
- The LDAP listener request handler that should be
used to process requests read from clients. It
must not be null
.public boolean useKeepAlive()
true
if the SO_KEEPALIVE socket option should be used for
sockets accepted by the listener, or false
if not.public void setUseKeepAlive(boolean useKeepAlive)
useKeepAlive
- Indicates whether to use the SO_KEEPALIVE socket
option for sockets accepted by the listener.public boolean useLinger()
true
if the SO_LINGER socket option should be used for
sockets accepted by the listener, or false
if not.public void setUseLinger(boolean useLinger)
useLinger
- Indicates whether to use the SO_LINGER socket option for
sockets accepted by the listener.public boolean useReuseAddress()
true
if the SO_REUSEADDR socket option should be used for
sockets accepted by the listener, or false
if not.public void setUseReuseAddress(boolean useReuseAddress)
useReuseAddress
- Indicates whether to use the SO_REUSEADDR socket
option for sockets accepted by the listener.public boolean useTCPNoDelay()
true
if the TCP_NODELAY socket option should be used for
sockets accepted by the listener, or false
if not.public void setUseTCPNoDelay(boolean useTCPNoDelay)
useTCPNoDelay
- Indicates whether to use the TCP_NODELAY socket
option for sockets accepted by the listener.@Nullable public java.net.InetAddress getListenAddress()
null
if it should listen on all available addresses on all
interfaces.public void setListenAddress(@Nullable java.net.InetAddress listenAddress)
listenAddress
- The address on which to listen for client
connections. It may be null
to indicate
that it should listen on all available addresses on
all interfaces.public int getLingerTimeoutSeconds()
public void setLingerTimeoutSeconds(int lingerTimeout)
lingerTimeout
- The timeout in seconds that should be used if the
SO_LINGER socket option is enabled. The value must
be between 0 and 65535, inclusive.public int getMaxConnections()
public void setMaxConnections(int maxConnections)
maxConnections
- The maximum number of concurrent connections that
the listener will allow. A value that is less than
or equal to zero indicates no limit.public int getMaxMessageSizeBytes()
public void setMaxMessageSizeBytes(int maxMessageSizeBytes)
maxMessageSizeBytes
- The maximum size in bytes for LDAP messages
that will be accepted by this listener. A
value that is less than or equal to zero will
use the maximum allowed message size.public int getReceiveBufferSize()
public void setReceiveBufferSize(int receiveBufferSize)
receiveBufferSize
- The receive buffer size that should be used for
sockets accepted by the listener.public int getSendBufferSize()
public void setSendBufferSize(int sendBufferSize)
sendBufferSize
- The send buffer size that should be used for
sockets accepted by the listener.@Nullable public LDAPListenerExceptionHandler getExceptionHandler()
null
if none is defined.public void setExceptionHandler(@Nullable LDAPListenerExceptionHandler exceptionHandler)
exceptionHandler
- The exception handler that should be notified of
any exceptions encountered during processing. It
may be null
if no exception handler
should be used.@NotNull public javax.net.ServerSocketFactory getServerSocketFactory()
public void setServerSocketFactory(@Nullable javax.net.ServerSocketFactory serverSocketFactory)
serverSocketFactory
- The factory that will be used to create the
server socket that will listen for client
connections. It may be null
to use
the JVM-default server socket factory.public boolean requestClientCertificate()
true
if the listener should request that the client
present its own certificate chain during TLS negotiation, or
false
if not.public void setRequestClientCertificate(boolean requestClientCertificate)
requestClientCertificate
- Indicates whether the listener should
request that the client present its own
certificate chain during TLS negotiation.public boolean requireClientCertificate()
requestClientCertificate
returns false.true
if the listener should require that the client
present its own certificate chain during TLS negotiation, or
false
if TLS negotiation should continue even if the
client did not present a certificate chain when requested.public void setRequireClientCertificate(boolean requireClientCertificate)
requestClientCertificate
returns false.requireClientCertificate
- Indicates whether the listener should
require that the client present its own
certificate chain during TLS negotiation.@NotNull public LDAPListenerConfig duplicate()
@NotNull public java.lang.String toString()
toString
in class java.lang.Object