@Extensible @DirectoryServerExtension @DirectoryProxyServerExtension(appliesToLocalContent=true, appliesToRemoteContent=true) @MetricsEngineExtension @BrokerExtension @SynchronizationServerExtension(appliesToLocalContent=true, appliesToSynchronizedContent=true) @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class HTTPServletExtension extends java.lang.Object implements UnboundIDExtension, Reconfigurable<HTTPServletExtensionConfig>, ExampleUsageProvider
dsconfig create-http-servlet-extension \ --extension-name "{extension-name}" \ --type third-party \ --set "extension-class:{class-name}" \ --set "extension-argument:{name=value}"where "{extension-name}" is the name to use for the HTTP servlet extension instance, "{class-name}" is the fully-qualified name of the Java class that extends
com.unboundid.directory.sdk.ds.api.HTTPServletExtension
,
and "{name=value}" represents name-value pairs for any arguments to
provide to the HTTP servlet extension. If multiple arguments should be
provided to the HTTP servlet extension, then the
"--set extension-argument:{name=value}
" option should be
provided multiple times.
WebAppServerContextFactory
class may be called from the web application in order to obtain a server
context.ScriptedHTTPServletExtension
Constructor and Description |
---|
HTTPServletExtension()
Creates a new instance of this HTTP servlet extension.
|
Modifier and Type | Method and Description |
---|---|
com.unboundid.ldap.sdk.ResultCode |
applyConfiguration(HTTPServletExtensionConfig config,
com.unboundid.util.args.ArgumentParser parser,
java.util.List<java.lang.String> adminActionsRequired,
java.util.List<java.lang.String> messages)
Attempts to apply the configuration from the provided argument parser to
this extension.
|
abstract javax.servlet.http.HttpServlet |
createServlet(HTTPServerContext serverContext,
HTTPServletExtensionConfig config,
com.unboundid.util.args.ArgumentParser parser)
Creates an HTTP servlet extension using the provided information.
|
void |
defineConfigArguments(com.unboundid.util.args.ArgumentParser parser)
Updates the provided argument parser to define any configuration arguments
which may be used by this extension.
|
void |
doPostRegistrationProcessing()
Performs any processing that may be needed after the servlet has been
registered with the servlet engine.
|
void |
doPostShutdownProcessing()
Performs any processing that may be needed after the servlet has been
taken out of service and the associated servlet engine has been shut down.
|
java.util.Map<java.util.List<java.lang.String>,java.lang.String> |
getExamplesArgumentSets()
Retrieves a map containing examples of configurations that may be used for
this extension.
|
abstract java.lang.String[] |
getExtensionDescription()
Retrieves a human-readable description for this extension.
|
abstract java.lang.String |
getExtensionName()
Retrieves a human-readable name for this extension.
|
java.util.List<javax.servlet.Filter> |
getServletFilters()
Retrieves a list of servlet filter instances that should be installed with
the created servlet instance, in the order they should be invoked.
|
int |
getServletInitOrder()
Retrieves the order in which the servlet should be started.
|
java.util.Map<java.lang.String,java.lang.String> |
getServletInitParameters()
Retrieves a map of initialization parameters that should be provided to the
servlet when it is initialized.
|
abstract java.util.List<java.lang.String> |
getServletPaths()
Retrieves a list of the request paths for which the associated servlet
should be invoked.
|
boolean |
isConfigurationAcceptable(HTTPServletExtensionConfig config,
com.unboundid.util.args.ArgumentParser parser,
java.util.List<java.lang.String> unacceptableReasons)
Indicates whether the configuration represented by the provided argument
parser is acceptable for use by this extension.
|
public HTTPServletExtension()
createServlet
method.public abstract java.lang.String getExtensionName()
getExtensionName
in interface UnboundIDExtension
public abstract java.lang.String[] getExtensionDescription()
getExtensionDescription
in interface UnboundIDExtension
null
or an empty array if no description should be available.public void defineConfigArguments(com.unboundid.util.args.ArgumentParser parser) throws com.unboundid.util.args.ArgumentException
defineConfigArguments
in interface Configurable
parser
- The argument parser to be updated with the configuration
arguments which may be used by this extension.com.unboundid.util.args.ArgumentException
- If a problem is encountered while updating the
provided argument parser.public boolean isConfigurationAcceptable(HTTPServletExtensionConfig config, com.unboundid.util.args.ArgumentParser parser, java.util.List<java.lang.String> unacceptableReasons)
isConfigurationAcceptable
in interface Reconfigurable<HTTPServletExtensionConfig>
config
- The general configuration for this extension.parser
- The argument parser that has been used to
parse the proposed configuration for this
extension.unacceptableReasons
- A list to which messages may be added to
provide additional information about why the
provided configuration is not acceptable.true
if the configuration in the provided argument parser
appears to be acceptable, or false
if not.public com.unboundid.ldap.sdk.ResultCode applyConfiguration(HTTPServletExtensionConfig config, com.unboundid.util.args.ArgumentParser parser, java.util.List<java.lang.String> adminActionsRequired, java.util.List<java.lang.String> messages)
applyConfiguration
in interface Reconfigurable<HTTPServletExtensionConfig>
config
- The general configuration for this extension.parser
- The argument parser that has been used to
parse the new configuration for this
extension.adminActionsRequired
- A list to which messages may be added to
provide additional information about any
additional administrative actions that may
be required to apply some of the
configuration changes.messages
- A list to which messages may be added to
provide additional information about the
processing performed by this method.SUCCESS
should be
used to indicate that all processing completed successfully. Any
other result will indicate that a problem occurred during
processing.public java.util.Map<java.util.List<java.lang.String>,java.lang.String> getExamplesArgumentSets()
getExamplesArgumentSets
in interface ExampleUsageProvider
null
or empty if there should
not be any example argument sets.public abstract javax.servlet.http.HttpServlet createServlet(HTTPServerContext serverContext, HTTPServletExtensionConfig config, com.unboundid.util.args.ArgumentParser parser) throws com.unboundid.ldap.sdk.LDAPException
serverContext
- A handle to the server context for the server in
which this extension is running.config
- The general configuration for this HTTP servlet
extension.parser
- The argument parser which has been initialized from
the configuration for this HTTP servlet extension.com.unboundid.ldap.sdk.LDAPException
- If a problem is encountered while attempting to
create the HTTP servlet.public abstract java.util.List<java.lang.String> getServletPaths()
createServlet(com.unboundid.directory.sdk.http.types.HTTPServerContext, com.unboundid.directory.sdk.http.config.HTTPServletExtensionConfig, com.unboundid.util.args.ArgumentParser)
method has been used to create the servlet instance.public java.util.Map<java.lang.String,java.lang.String> getServletInitParameters()
public int getServletInitOrder()
doPostRegistrationProcessing
method has been called. If the value is less than zero, the servlet may
not be started until a request is received for one of its registered paths.public java.util.List<javax.servlet.Filter> getServletFilters()
null
or empty if no servlet filters
should be installed.public void doPostRegistrationProcessing()
getServletInitOrder()
is greater than or equal to zero, then the
servlet will have been started before this method is called. If the value
returned from getServletInitOrder()
is negative, then the servlet
may or may not have been started by the time this method is called.
init
method provided by the
servlet API.public void doPostShutdownProcessing()
destroy
method provided by the
servlet API. That method will be called after the servlet has been taken
out of service, but before the servlet engine has been shut down.