Class ServletPathMapper

java.lang.Object
org.apache.commons.chain.generic.LookupCommand
org.apache.commons.chain.web.servlet.ServletPathMapper
All Implemented Interfaces:
Command, Filter

public class ServletPathMapper extends LookupCommand implements Command

Command that uses the "servlet path" component of the request URI to select a Command from the appropriate Catalog, and execute it. To use this command, you would typically map an instance of ChainProcessor to an extension pattern like "*.execute" and then arrange that this is the default command to be executed. In such an environment, a request for a context relative URI of "/foo.execute" would cause the "/foo.execute" command to be loaded and executed.

Author:
Craig R. McClanahan
  • Field Details

    • catalogKey

      private String catalogKey
  • Constructor Details

    • ServletPathMapper

      public ServletPathMapper()
  • Method Details

    • getCatalogKey

      public String getCatalogKey()
      Deprecated.
      Use catalogName to specify the name of the catalog in the catalog factory

      Return the context key under which our Catalog has been stored.

      Returns:
      The context key for the Catalog.
    • setCatalogKey

      public void setCatalogKey(String catalogKey)
      Deprecated.
      Use catalogName to specify the name of the catalog in the catalog factory

      Set the context key under which our Catalog has been stored.

      Parameters:
      catalogKey - The new catalog key
    • getCommandName

      protected String getCommandName(Context context)

      Look up the servlet path information for this request, and use it to select an appropriate Command to be executed.

      Overrides:
      getCommandName in class LookupCommand
      Parameters:
      context - Context for the current request
      Returns:
      The name of the Command instance
      Since:
      Chain 1.2
    • getCatalog

      protected Catalog getCatalog(Context context)

      Return the Catalog to look up the Command in.

      Overrides:
      getCatalog in class LookupCommand
      Parameters:
      context - Context for this request
      Returns:
      The catalog.
      Throws:
      IllegalArgumentException - if no Catalog can be found
      Since:
      Chain 1.2