Class RequestParameterMapper
- java.lang.Object
-
- org.apache.commons.chain.generic.LookupCommand
-
- org.apache.commons.chain.web.servlet.RequestParameterMapper
-
public class RequestParameterMapper extends LookupCommand implements Command
Commandthat uses a specified request parameter to select aCommandfrom the appropriateCatalog, and execute it. To use this command, you would typically map an instance ofChainProcessorto a wildcard pattern like "*.execute" and then arrange that this is the default command to be executed. In such an environment, a request for the context-relative path "/foo.execute?command=bar" would cause the "/bar" command to be loaded and executed.- Author:
- Craig R. McClanahan
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringcatalogKeyprivate java.lang.Stringparameter-
Fields inherited from interface org.apache.commons.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
-
-
Constructor Summary
Constructors Constructor Description RequestParameterMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected CataloggetCatalog(Context context)java.lang.StringgetCatalogKey()Return the context key under which ourCataloghas been stored.protected java.lang.StringgetCommandName(Context context)Look up the specified request paramater for this request, and use it to select an appropriateCommandto be executed.java.lang.StringgetParameter()Deprecated.Use catalogName to specify the name of the catalog in the catalog factoryvoidsetCatalogKey(java.lang.String catalogKey)Deprecated.Use catalogName to specify the name of the catalog in the catalog factoryvoidsetParameter(java.lang.String parameter)Set the name of the request parameter to use for selecting theCommandto be executed.-
Methods inherited from class org.apache.commons.chain.generic.LookupCommand
execute, getCatalogFactory, getCatalogName, getCommand, getName, getNameKey, isIgnoreExecuteResult, isIgnorePostprocessResult, isOptional, postprocess, setCatalogFactory, setCatalogName, setIgnoreExecuteResult, setIgnorePostprocessResult, setName, setNameKey, setOptional
-
-
-
-
Method Detail
-
getCatalogKey
public java.lang.String getCatalogKey()
Return the context key under which our
Cataloghas been stored.- Returns:
- The context key for the Catalog.
-
setCatalogKey
public void setCatalogKey(java.lang.String catalogKey)
Deprecated.Use catalogName to specify the name of the catalog in the catalog factorySet the context key under which our
Cataloghas been stored.- Parameters:
catalogKey- The new catalog key
-
getParameter
public java.lang.String getParameter()
Deprecated.Use catalogName to specify the name of the catalog in the catalog factoryReturn the name of the request parameter to use for selecting the
Commandto be executed.- Returns:
- The name of the request parameter.
-
setParameter
public void setParameter(java.lang.String parameter)
Set the name of the request parameter to use for selecting the
Commandto be executed.- Parameters:
parameter- The new parameter name
-
getCommandName
protected java.lang.String getCommandName(Context context)
Look up the specified request paramater for this request, and use it to select an appropriate
Commandto be executed.- Overrides:
getCommandNamein classLookupCommand- Parameters:
context- Context for the current request- Returns:
- The name of the
Commandinstance - Since:
- Chain 1.2
-
getCatalog
protected Catalog getCatalog(Context context)
- Overrides:
getCatalogin classLookupCommand- Parameters:
context-Contextfor this request- Returns:
- The catalog.
- Throws:
java.lang.IllegalArgumentException- if noCatalogcan be found- Since:
- Chain 1.2
-
-