Configure an HTTP connection handler
About this task
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.
Steps
-
The first step is to 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"
-
Next, 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 that some configuration properties can be later updated on the fly while others, like 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"
-
By default, the HTTP Connection Handler has an advanced monitor entry property,
keep- stats
, that is set toTRUE
by default. You can monitor the connection handler using theldapsearch
tool.$ bin/ldapsearch --baseDN "cn=monitor" \ "(objectClass=ds-http-connection-handler-statistics-monitor-entry)"