Package org.opends.server.protocols.http
Class HTTPConnectionHandler
java.lang.Object
org.opends.server.api.ConnectionHandler<HttpConnectionHandlerCfg>
org.opends.server.protocols.http.HTTPConnectionHandler
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConfigurationChangeListener<HttpConnectionHandlerCfg>
,AlertGenerator
public final class HTTPConnectionHandler
extends ConnectionHandler<HttpConnectionHandlerCfg>
implements ConfigurationChangeListener<HttpConnectionHandlerCfg>, AlertGenerator
This class defines a connection handler that will be used for communicating with clients over HTTP.
The connection handler is responsible for starting/stopping the embedded web server.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAdditionalMeters
(MeterRegistryHolder registry) Computes additional meters that is specific to the connection handler implementation.protected void
Adds the object class names that should be included in the monitor entry related to this connection handler to the provided attribute.Applies the configuration changes to this change listener.void
bind()
Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.void
doClose()
Closes this connection handler so that it will no longer accept new client connections.void
doInitializeConnectionHandler
(ServerContext serverContext, HttpConnectionHandlerCfg config) Initializes this connection handler provider based on the information in the provided connection handler configuration.Retrieves information about the set of alerts that this generator may produce.Retrieves the set of active client connections that have been established through this connection handler.Retrieves the DN of the configuration entry with which this alert generator is associated.Retrieves a name that may be used to refer to this connection handler.Returns the type of this connection handler.Retrieves an unmodifiable set of enabled SSL cipher suites configured for this connection handler, if applicable.Retrieves the set of enabled SSL protocols configured for this connection handler.Collection<com.forgerock.opendj.util.HostPort>
Retrieves information about the listener(s) that will be used to accept client connections.Retrieves the name of the protocol used to communicate with clients.Returns the set of statistics maintained by this connection handler.boolean
isConfigurationAcceptable
(ServerContext serverContext, HttpConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons) Indicates whether the provided configuration is acceptable for this connection handler.boolean
isConfigurationChangeAcceptable
(HttpConnectionHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons) Indicates whether the proposed change to the configuration is acceptable to this change listener.void
toString
(StringBuilder buffer) Appends a string representation of this connection handler to the provided buffer.Methods inherited from class org.opends.server.api.ConnectionHandler
close, getNumRequestHandlers, getServerContext, initializeConnectionHandler, isAdministrative, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opends.server.api.AlertGenerator
getClassName
-
Constructor Details
-
HTTPConnectionHandler
public HTTPConnectionHandler()
-
-
Method Details
-
applyConfigurationChange
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<HttpConnectionHandlerCfg>
- Parameters:
config
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
doClose
public void doClose()Description copied from class:ConnectionHandler
Closes this connection handler so that it will no longer accept new client connections. Implementations should disconnect any existing connections and release any other resources associated with the connection handler.- Overrides:
doClose
in classConnectionHandler<HttpConnectionHandlerCfg>
-
getAlerts
Description copied from interface:AlertGenerator
Retrieves information about the set of alerts that this generator may produce. The map returned should be between the notification type for a particular notification and the human-readable description for that notification. This alert generator must not generate any alerts with types that are not contained in this list.- Specified by:
getAlerts
in interfaceAlertGenerator
- Returns:
- Information about the set of alerts that this generator may produce.
-
getClientConnections
Description copied from class:ConnectionHandler
Retrieves the set of active client connections that have been established through this connection handler.- Specified by:
getClientConnections
in classConnectionHandler<HttpConnectionHandlerCfg>
- Returns:
- The set of active client connections that have been established through this connection handler.
-
getComponentEntryDN
Description copied from class:ConnectionHandler
Retrieves the DN of the configuration entry with which this alert generator is associated.- Specified by:
getComponentEntryDN
in interfaceAlertGenerator
- Specified by:
getComponentEntryDN
in classConnectionHandler<HttpConnectionHandlerCfg>
- Returns:
- The DN of the configuration entry with which this alert generator is associated.
-
getConnectionHandlerName
Description copied from class:ConnectionHandler
Retrieves a name that may be used to refer to this connection handler. Every connection handler instance (even handlers of the same type) must have a unique name.- Specified by:
getConnectionHandlerName
in classConnectionHandler<HttpConnectionHandlerCfg>
- Returns:
- A unique name that may be used to refer to this connection handler.
-
getConnectionHandlerType
Description copied from class:ConnectionHandler
Returns the type of this connection handler. By default this returnsConnectionHandler.getProtocol()
. It should be returning the insecure protocol version.- Overrides:
getConnectionHandlerType
in classConnectionHandler<HttpConnectionHandlerCfg>
- Returns:
- The type of this connection handler.
-
getEnabledSSLCipherSuites
Description copied from class:ConnectionHandler
Retrieves an unmodifiable set of enabled SSL cipher suites configured for this connection handler, if applicable. Implementations must return an empty set if use of SSL/TLS is not possible.- Overrides:
getEnabledSSLCipherSuites
in classConnectionHandler<HttpConnectionHandlerCfg>
- Returns:
- The set of enabled SSL cipher suites configured for this connection handler.
-
getEnabledSSLProtocols
Description copied from class:ConnectionHandler
Retrieves the set of enabled SSL protocols configured for this connection handler. Implementations must return an empty set if use of SSL/TLS is not possible.- Overrides:
getEnabledSSLProtocols
in classConnectionHandler<HttpConnectionHandlerCfg>
- Returns:
- The set of enabled SSL protocols configured for this connection handler.
-
getListeners
Description copied from class:ConnectionHandler
Retrieves information about the listener(s) that will be used to accept client connections.- Specified by:
getListeners
in classConnectionHandler<HttpConnectionHandlerCfg>
- Returns:
- Information about the listener(s) that will be used to accept client connections, or an empty list if this connection handler does not accept connections from network clients.
-
getProtocol
Description copied from class:ConnectionHandler
Retrieves the name of the protocol used to communicate with clients. It should take into account any special naming that may be needed to express any security mechanisms or other constraints in place (e.g., "LDAPS" for LDAP over SSL).- Specified by:
getProtocol
in classConnectionHandler<HttpConnectionHandlerCfg>
- Returns:
- The name of the protocol used to communicate with clients.
-
getStatTracker
Returns the set of statistics maintained by this connection handler.- Returns:
- The set of statistics maintained by this connection handler.
-
addAdditionalMeters
Description copied from class:ConnectionHandler
Computes additional meters that is specific to the connection handler implementation. The default implementation is to do nothing.- Overrides:
addAdditionalMeters
in classConnectionHandler<HttpConnectionHandlerCfg>
- Parameters:
registry
- where additional meters should be added.
-
addAdditionalMonitorObjectClassNames
Description copied from class:ConnectionHandler
Adds the object class names that should be included in the monitor entry related to this connection handler to the provided attribute.- Overrides:
addAdditionalMonitorObjectClassNames
in classConnectionHandler<HttpConnectionHandlerCfg>
- Parameters:
ocAttr
- The object class attribute on which the object class names are added.
-
doInitializeConnectionHandler
public void doInitializeConnectionHandler(ServerContext serverContext, HttpConnectionHandlerCfg config) throws InitializationException Description copied from class:ConnectionHandler
Initializes this connection handler provider based on the information in the provided connection handler configuration.- Specified by:
doInitializeConnectionHandler
in classConnectionHandler<HttpConnectionHandlerCfg>
- Parameters:
serverContext
- The server context.config
- The connection handler configuration that contains the information to use to initialize this connection handler.- Throws:
InitializationException
- If a problem occurs during initialization that is not related to the server configuration.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(ServerContext serverContext, HttpConnectionHandlerCfg config, List<LocalizableMessage> unacceptableReasons) Description copied from class:ConnectionHandler
Indicates whether the provided configuration is acceptable for this connection handler. It should be possible to call this method on an uninitialized connection handler instance in order to determine whether the connection handler would be able to use the provided configuration.- Overrides:
isConfigurationAcceptable
in classConnectionHandler<HttpConnectionHandlerCfg>
- Parameters:
serverContext
- The server contextconfig
- The connection handler configuration for which to make the determination.unacceptableReasons
- A list that may be used to hold the reasons that the provided configuration is not acceptable.- Returns:
true
if the provided configuration is acceptable for this connection handler, orfalse
if not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(HttpConnectionHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons) Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in interfaceConfigurationChangeListener<HttpConnectionHandlerCfg>
- Parameters:
configuration
- The new configuration containing the changes.unacceptableReasons
- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
true
if the proposed change is acceptable, orfalse
if it is not.
-
bind
Description copied from class:ConnectionHandler
Operates in a loop, accepting new connections and ensuring that requests on those connections are handled properly.- Specified by:
bind
in classConnectionHandler<HttpConnectionHandlerCfg>
- Throws:
IOException
- If theConnectionHandler
cannot be bound.
-
toString
Description copied from class:ConnectionHandler
Appends a string representation of this connection handler to the provided buffer.- Specified by:
toString
in classConnectionHandler<HttpConnectionHandlerCfg>
- Parameters:
buffer
- The buffer to which the information should be appended.
-