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,javax.servlet.Servlet,javax.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 configuredCatalogused 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
Commands processing our requests, in addition to its definition
of the ServletContext attribute key under which the
Catalog is available.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the servlet init parameter containing the name of theCatalogto use for processing incoming requests.static final Stringstatic final StringFields inherited from class org.apache.commons.chain.web.javax.ChainServlet
CONFIG_ATTR, CONFIG_CLASS_RESOURCE, CONFIG_WEB_RESOURCE, RULE_SET -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Clean up as this application is shut down.voidinit()Cache the name of the command we should execute for each request.voidservice(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Configure aServletWebContextfor 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, serviceMethods 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 theCatalogto 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 configuredCatalogto 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:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classChainServlet
-
init
Cache the name of the command we should execute for each request.- Overrides:
initin classChainServlet- Throws:
javax.servlet.ServletException- if an initialization error occurs
-
service
public void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException Configure aServletWebContextfor the current request, and pass it to theexecute()method of the specifiedCommand, loaded from our configuredCatalog.- Overrides:
servicein classChainServlet- Parameters:
request- The request we are processingresponse- The response we are creating- Throws:
IOException- if an input/output error occursjavax.servlet.ServletException- if a servlet exception occurs
-