Class ChainProcessor
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.commons.chain.web.javax.ChainServlet
org.apache.commons.chain.web.javax.servlet.ChainProcessor
- All Implemented Interfaces:
Serializable
,Servlet
,ServletConfig
Custom subclass of
ChainServlet
that also dispatches incoming
requests to a configurable Command
loaded from the specified
Catalog
.
In addition to the servlet init parameters supported by
ChainServlet
, this class supports the following additional
parameters:
- org.apache.commons.chain.CATALOG - Name of the catalog from which to acquire commands to be executed. If not specified, the default catalog for this application will be used.
- org.apache.commons.chain.COMMAND - Name of the
Command
(looked up in our configuredCatalog
used to process all incoming servlet requests. If not specified, defaults tocommand
.
Also, the org.apache.commons.chain.CONFIG_ATTR
init parameter is also used to identify the
Context
attribute under
which our configured Catalog
will be made available to
Command
s processing our requests, in addition to its definition
of the ServletContext
attribute key under which the
Catalog
is available.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The name of the servlet init parameter containing the name of theCatalog
to use for processing incoming requests.static final String
static final String
Fields inherited from class org.apache.commons.chain.web.javax.ChainServlet
CONFIG_ATTR, CONFIG_CLASS_RESOURCE, CONFIG_WEB_RESOURCE, RULE_SET
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Clean up as this application is shut down.void
init()
Cache the name of the command we should execute for each request.void
service
(HttpServletRequest request, HttpServletResponse response) Configure aServletWebContext
for the current request, and pass it to theexecute()
method of the specifiedCommand
, loaded from our configuredCatalog
.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
CATALOG
The name of the servlet init parameter containing the name of theCatalog
to use for processing incoming requests.- See Also:
-
CATALOG_DEFAULT
- See Also:
-
COMMAND
The name of the servlet init parameter containing the name of theCommand
(loaded from our configuredCatalog
to use for processing each incoming request.- See Also:
-
-
Constructor Details
-
ChainProcessor
public ChainProcessor()The Default-Constructor for this class.
-
-
Method Details
-
destroy
Clean up as this application is shut down.- Specified by:
destroy
in interfaceServlet
- Overrides:
destroy
in classChainServlet
-
init
Cache the name of the command we should execute for each request.- Overrides:
init
in classChainServlet
- Throws:
ServletException
- if an initialization error occurs
-
service
public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException Configure aServletWebContext
for the current request, and pass it to theexecute()
method of the specifiedCommand
, loaded from our configuredCatalog
.- Overrides:
service
in classChainServlet
- Parameters:
request
- The request we are processingresponse
- The response we are creating- Throws:
IOException
- if an input/output error occursServletException
- if a servlet exception occurs
-