Class 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 TypeFieldDescriptionprivate StringThe name of the context attribute under which ourCatalogis stored.private StringThe name of theCatalogto retrieve from theCatalogFactoryfor this application, ornullto select the defaultCatalog.static final StringThe name of the servlet init parameter containing the name of theCatalogto use for processing incoming requests.static final Stringprivate StringThe name of theCommandto be executed for each incoming request.static final Stringprivate static final StringThe default command name.Fields inherited from class 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
-
CATALOG_DEFAULT
-
COMMAND
-
COMMAND_DEFAULT
-
attribute
The name of the context attribute under which our
Catalogis stored. This value is also used as the name of the context attribute under which the catalog is exposed to commands. If not specified, we will look up commands in the appropriateCatalogretrieved from ourCatalogFactory. -
catalog
The name of the
Catalogto retrieve from theCatalogFactoryfor this application, ornullto select the defaultCatalog. -
command
-
-
Constructor Details
-
ChainProcessor
public ChainProcessor()
-
-
Method Details
-
destroy
public void destroy()Clean up as this application is shut down.
- Specified by:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classChainServlet
-
init
public void init() throws javax.servlet.ServletExceptionCache 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 a
ServletWebContextfor 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
-