Configure an HTTP connection handler by configuring the HTTP servlet extensions and the
HTTP log publishers.
An HTTP connection handler has two dependent
configuration objects: one or more HTTP servlet extensions and optionally, an HTTP log
publisher. The HTTP servlet extension and log publisher must be configured before
configuring the HTTP connection handler. The log publisher is optional but in most
cases, you want to configure one or more logs to troubleshoot any issues with your HTTP
connection.
-
Configure your HTTP servlet extensions.
The following example uses the ExampleHTTPServletExtension in the Server SDK.
$ bin/dsconfig create-http-servlet-extension \
--extension-name "Hello World Servlet" \
--type third-party \
--set
"extensionclass:com.unboundid.directory.sdk.examples.ExampleHTTPServletEx
tension" \
--set "extension-argument:path=/" \
--set "extension-argument:name=example-servlet"
-
Configure one or more HTTP log publishers.
The following example configures two log publishers: one for common access;
the other, detailed access. Both log publishers use the default configuration
settings for log rotation and retention.
$ bin/dsconfig create-log-publisher \
--publisher-name "HTTP Common Access Logger" \
--type common-log-file-http-operation \
--set enabled:true \
--set log-file:logs/http-common-access \
--set "rotation-policy:24 Hours Time Limit Rotation Policy" \
--set "rotation-policy:Size Limit Rotation Policy" \
--set "retention-policy:File Count Retention Policy" \
--set "retention-policy:Free Disk Space Retention Policy"
$ bin/dsconfig create-log-publisher \
--publisher-name "HTTP Detailed Access Logger" \
--type detailed-http-operation \
--set enabled:true \
--set log-file:logs/http-detailed-access \
--set "rotation-policy:24 Hours Time Limit Rotation Policy" \
--set "rotation-policy:Size Limit Rotation Policy" \
--set "retention-policy:File Count Retention Policy" \
--set "retention-policy:Free Disk Space Retention Policy"
-
Configure the HTTP connection handler by specifying the HTTP servlet extension
and log publishers.
Note:
Some configuration properties can be later updated on the fly while
others, such as listen-port, require that the HTTP Connection Handler be
disabled, then re-enabled for the change to take effect.
$ bin/dsconfig create-connection-handler \
--handler-name "Hello World HTTP Connection Handler" \
--type http \
--set enabled:true \
--set listen-port:8443 \
--set use-ssl:true \
--set "http-servlet-extension:Hello World Servlet" \
--set "http-operation-log-publisher:HTTP Common Access Logger" \
--set "http-operation-log-publisher:HTTP Detailed Access Logger" \
--set "key-manager-provider:JKS" \
--set "trust-manager-provider:JKS"
-
Monitor the connection handler using the
ldapsearch
tool.
Note:
The HTTP Connection Handler has an advanced monitor entry property,
keep-stats
, that is set to TRUE by default.
$ bin/ldapsearch --baseDN "cn=monitor" \
"(objectClass=ds-http-connection-handler-statistics-monitor-entry)"