Class ChainProcessor

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.commons.chain.web.jakarta.ChainServlet
org.apache.commons.chain.web.jakarta.servlet.ChainProcessor
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class ChainProcessor extends ChainServlet
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 configured Catalog used to process all incoming servlet requests. If not specified, defaults to command.

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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name of the servlet init parameter containing the name of the Catalog to use for processing incoming requests.
    static final String
    The default request attribute under which we expose the Catalog being used to subordinate Commands.
    static final String
    The name of the servlet init parameter containing the name of the Command (loaded from our configured Catalog to use for processing each incoming request.

    Fields inherited from class org.apache.commons.chain.web.jakarta.ChainServlet

    CONFIG_ATTR, CONFIG_CLASS_RESOURCE, CONFIG_WEB_RESOURCE, RULE_SET
  • Constructor Summary

    Constructors
    Constructor
    Description
    The Default-Constructor for this class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clean up as this application is shut down.
    void
    Cache the name of the command we should execute for each request.
    void
    service(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Configure a ServletWebContext for the current request, and pass it to the execute() method of the specified Command, loaded from our configured Catalog.

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service

    Methods inherited from class jakarta.servlet.GenericServlet

    getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ChainProcessor

      public ChainProcessor()
      The Default-Constructor for this class.
  • Method Details

    • destroy

      public void destroy()
      Clean up as this application is shut down.
      Specified by:
      destroy in interface jakarta.servlet.Servlet
      Overrides:
      destroy in class ChainServlet
    • init

      public void init() throws jakarta.servlet.ServletException
      Cache the name of the command we should execute for each request.
      Overrides:
      init in class ChainServlet
      Throws:
      jakarta.servlet.ServletException - if an initialization error occurs
    • service

      public void service(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
      Configure a ServletWebContext for the current request, and pass it to the execute() method of the specified Command, loaded from our configured Catalog.
      Overrides:
      service in class ChainServlet
      Parameters:
      request - The request we are processing
      response - The response we are creating
      Throws:
      IOException - if an input/output error occurs
      jakarta.servlet.ServletException - if a servlet exception occurs