Package com.unboundid.ldap.listener
Class LDAPListenerConfig
java.lang.Object
com.unboundid.ldap.listener.LDAPListenerConfig
This class provides a mechanism for defining the configuration to use for an
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 Summary
ConstructorsConstructorDescriptionLDAPListenerConfig(int listenPort, LDAPListenerRequestHandler requestHandler) Creates a new listener configuration. -
Method Summary
Modifier and TypeMethodDescriptionCreates a copy of this configuration that may be altered without impacting this configuration, and which will not be altered by changes to this configuration.Retrieves the exception handler that should be notified of any exceptions caught while attempting to accept or interact with a client connection.intRetrieves the timeout in seconds that should be used if the SO_LINGER socket option is enabled.Retrieves the address on which to listen for client connections, if defined.intRetrieves the port number on which to listen for client connections.intRetrieves the maximum number of concurrent connections that the listener will allow.intRetrieves the maximum size in bytes for LDAP messages that will be accepted by this listener.intRetrieves the receive buffer size that should be used for sockets accepted by the listener.Retrieves the LDAP listener request handler that should be used to process requests read from clients.intRetrieves the send buffer size that should be used for sockets accepted by the listener.Retrieves the factory that will be used to create the server socket that will listen for client connections.booleanIndicates whether the listener should request that the client present its own certificate chain during TLS negotiation.booleanIndicates 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.voidsetExceptionHandler(LDAPListenerExceptionHandler exceptionHandler) Specifies the exception handler that should be notified of any exceptions caught while attempting to accept or interact with a client connection.voidsetLingerTimeoutSeconds(int lingerTimeout) Specifies the timeout in seconds that should be used if the SO_LINGER socket option is enabled.voidsetListenAddress(InetAddress listenAddress) Specifies the address on which to listen for client connections.voidsetListenPort(int listenPort) Specifies the port number on which to listen for client connections.voidsetMaxConnections(int maxConnections) Specifies the maximum number of concurrent connections that the listener will allow.voidsetMaxMessageSizeBytes(int maxMessageSizeBytes) Specifies the maximum size in bytes for LDAP messages that will be accepted by this listener.voidsetReceiveBufferSize(int receiveBufferSize) Specifies the receive buffer size that should be used for sockets accepted by the listener.voidsetRequestClientCertificate(boolean requestClientCertificate) Specifies whether the listener should request that the client present its own certificate chain during TLS negotiation.voidsetRequestHandler(LDAPListenerRequestHandler requestHandler) Specifies the LDAP listener request handler that should be used to process requests read from clients.voidsetRequireClientCertificate(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.voidsetSendBufferSize(int sendBufferSize) Specifies the send buffer size that should be used for sockets accepted by the listener.voidsetServerSocketFactory(ServerSocketFactory serverSocketFactory) Specifies the factory that will be used to create the server socket that will listen for client connections.voidsetUseKeepAlive(boolean useKeepAlive) Specifies whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.voidsetUseLinger(boolean useLinger) Specifies whether to use the SO_LINGER socket option for sockets accepted by the listener.voidsetUseReuseAddress(boolean useReuseAddress) Specifies whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.voidsetUseTCPNoDelay(boolean useTCPNoDelay) Specifies whether to use the TCP_NODELAY socket option for sockets accepted by the listener.toString()Retrieves a string representation of this LDAP listener config.voidtoString(StringBuilder buffer) Appends a string representation of this LDAP listener config to the provided buffer.booleanIndicates whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.booleanIndicates whether to use the SO_LINGER socket option for sockets accepted by the listener.booleanIndicates whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.booleanIndicates whether to use the TCP_NODELAY socket option for sockets accepted by the listener.
-
Constructor Details
-
LDAPListenerConfig
Creates a new listener configuration.- Parameters:
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 benull.
-
-
Method Details
-
getListenPort
Retrieves the port number on which to listen for client connections. A value of zero indicates that the listener should allow the JVM to choose a free port.- Returns:
- The port number on which to listen for client connections.
-
setListenPort
Specifies the port number on which to listen for client connections. The provided value must be between 1 and 65535, or it may be 0 to indicate that the JVM should select a free port on the system.- Parameters:
listenPort- The port number on which to listen for client connections.
-
getRequestHandler
Retrieves the LDAP listener request handler that should be used to process requests read from clients.- Returns:
- The LDAP listener request handler that should be used to process requests read from clients.
-
setRequestHandler
Specifies the LDAP listener request handler that should be used to process requests read from clients.- Parameters:
requestHandler- The LDAP listener request handler that should be used to process requests read from clients. It must not benull.
-
useKeepAlive
Indicates whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.- Returns:
trueif the SO_KEEPALIVE socket option should be used for sockets accepted by the listener, orfalseif not.
-
setUseKeepAlive
Specifies whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.- Parameters:
useKeepAlive- Indicates whether to use the SO_KEEPALIVE socket option for sockets accepted by the listener.
-
useLinger
Indicates whether to use the SO_LINGER socket option for sockets accepted by the listener.- Returns:
trueif the SO_LINGER socket option should be used for sockets accepted by the listener, orfalseif not.
-
setUseLinger
Specifies whether to use the SO_LINGER socket option for sockets accepted by the listener.- Parameters:
useLinger- Indicates whether to use the SO_LINGER socket option for sockets accepted by the listener.
-
useReuseAddress
Indicates whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.- Returns:
trueif the SO_REUSEADDR socket option should be used for sockets accepted by the listener, orfalseif not.
-
setUseReuseAddress
Specifies whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.- Parameters:
useReuseAddress- Indicates whether to use the SO_REUSEADDR socket option for sockets accepted by the listener.
-
useTCPNoDelay
Indicates whether to use the TCP_NODELAY socket option for sockets accepted by the listener.- Returns:
trueif the TCP_NODELAY socket option should be used for sockets accepted by the listener, orfalseif not.
-
setUseTCPNoDelay
Specifies whether to use the TCP_NODELAY socket option for sockets accepted by the listener.- Parameters:
useTCPNoDelay- Indicates whether to use the TCP_NODELAY socket option for sockets accepted by the listener.
-
getListenAddress
Retrieves the address on which to listen for client connections, if defined.- Returns:
- The address on which to listen for client connections, or
nullif it should listen on all available addresses on all interfaces.
-
setListenAddress
Specifies the address on which to listen for client connections.- Parameters:
listenAddress- The address on which to listen for client connections. It may benullto indicate that it should listen on all available addresses on all interfaces.
-
getLingerTimeoutSeconds
Retrieves the timeout in seconds that should be used if the SO_LINGER socket option is enabled.- Returns:
- The timeout in seconds that should be used if the SO_LINGER socket option is enabled.
-
setLingerTimeoutSeconds
Specifies the timeout in seconds that should be used if the SO_LINGER socket option is enabled.- Parameters:
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.
-
getMaxConnections
Retrieves the maximum number of concurrent connections that the listener will allow. If a client tries to establish a new connection while the listener already has the maximum number of concurrent connections, then the new connection will be rejected.- Returns:
- The maximum number of concurrent connections that the listener will allow, or zero if no limit should be enforced.
-
setMaxConnections
Specifies the maximum number of concurrent connections that the listener will allow. If a client tries to establish a new connection while the listener already has the maximum number of concurrent connections, then the new connection will be rejected.- Parameters:
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.
-
getMaxMessageSizeBytes
Retrieves the maximum size in bytes for LDAP messages that will be accepted by this listener.- Returns:
- The maximum size in bytes for LDAP messages that will be accepted by this listener.
-
setMaxMessageSizeBytes
Specifies the maximum size in bytes for LDAP messages that will be accepted by this listener.- Parameters:
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.
-
getReceiveBufferSize
Retrieves the receive buffer size that should be used for sockets accepted by the listener.- Returns:
- The receive buffer size that should be used for sockets accepted by the listener, or 0 if the default receive buffer size should be used.
-
setReceiveBufferSize
Specifies the receive buffer size that should be used for sockets accepted by the listener. A value less than or equal to zero indicates that the default receive buffer size should be used.- Parameters:
receiveBufferSize- The receive buffer size that should be used for sockets accepted by the listener.
-
getSendBufferSize
Retrieves the send buffer size that should be used for sockets accepted by the listener.- Returns:
- The send buffer size that should be used for sockets accepted by the listener, or 0 if the default send buffer size should be used.
-
setSendBufferSize
Specifies the send buffer size that should be used for sockets accepted by the listener. A value less than or equal to zero indicates that the default send buffer size should be used.- Parameters:
sendBufferSize- The send buffer size that should be used for sockets accepted by the listener.
-
getExceptionHandler
Retrieves the exception handler that should be notified of any exceptions caught while attempting to accept or interact with a client connection.- Returns:
- The exception handler that should be notified of any exceptions
caught while attempting to accept or interact with a client
connection, or
nullif none is defined.
-
setExceptionHandler
Specifies the exception handler that should be notified of any exceptions caught while attempting to accept or interact with a client connection.- Parameters:
exceptionHandler- The exception handler that should be notified of any exceptions encountered during processing. It may benullif no exception handler should be used.
-
getServerSocketFactory
Retrieves the factory that will be used to create the server socket that will listen for client connections.- Returns:
- The factory that will be used to create the server socket that will listen for client connections.
-
setServerSocketFactory
Specifies the factory that will be used to create the server socket that will listen for client connections.- Parameters:
serverSocketFactory- The factory that will be used to create the server socket that will listen for client connections. It may benullto use the JVM-default server socket factory.
-
requestClientCertificate
Indicates whether the listener should request that the client present its own certificate chain during TLS negotiation. This will be ignored for non-TLS-based connections.- Returns:
trueif the listener should request that the client present its own certificate chain during TLS negotiation, orfalseif not.
-
setRequestClientCertificate
Specifies whether the listener should request that the client present its own certificate chain during TLS negotiation. This will be ignored for non-TLS-based connections.- Parameters:
requestClientCertificate- Indicates whether the listener should request that the client present its own certificate chain during TLS negotiation.
-
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. This will be ignored for non-TLS-based connections, and it will also be ignored ifrequestClientCertificatereturns false.- Returns:
trueif the listener should require that the client present its own certificate chain during TLS negotiation, orfalseif TLS negotiation should continue even if the client did not present a certificate chain when requested.
-
setRequireClientCertificate
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. This will be ignored for non-TLS-based connections, and it will also be ignored ifrequestClientCertificatereturns false.- Parameters:
requireClientCertificate- Indicates whether the listener should require that the client present its own certificate chain during TLS negotiation.
-
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.- Returns:
- A copy of this configuration that may be altered without impacting this configuration, and which will not be altered by changes to this configuration.
-
toString
Retrieves a string representation of this LDAP listener config. -
toString
Appends a string representation of this LDAP listener config to the provided buffer.- Parameters:
buffer- The buffer to which the information should be appended.
-