public class RequestParameterMapper extends LookupCommand implements Command
Command
that uses a specified request parameter
to select a Command
from the appropriate Catalog
, and
execute it. To use this command, you would typically map an instance
of ChainProcessor
to 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.
Modifier and Type | Field | Description |
---|---|---|
private java.lang.String |
catalogKey |
|
private java.lang.String |
parameter |
CONTINUE_PROCESSING, PROCESSING_COMPLETE
Constructor | Description |
---|---|
RequestParameterMapper() |
Modifier and Type | Method | Description |
---|---|---|
protected Catalog |
getCatalog(Context context) |
|
java.lang.String |
getCatalogKey() |
Return the context key under which our
Catalog has been
stored. |
protected java.lang.String |
getCommandName(Context context) |
Look up the specified request paramater for this request, and use it
to select an appropriate
Command to be executed. |
java.lang.String |
getParameter() |
Deprecated.
Use catalogName to specify the name of the catalog in the
catalog factory
|
void |
setCatalogKey(java.lang.String catalogKey) |
Deprecated.
Use catalogName to specify the name of the catalog in the
catalog factory
|
void |
setParameter(java.lang.String parameter) |
Set the name of the request parameter to use for
selecting the
Command to be executed. |
execute, getCatalogFactory, getCatalogName, getCommand, getName, getNameKey, isIgnoreExecuteResult, isIgnorePostprocessResult, isOptional, postprocess, setCatalogFactory, setCatalogName, setIgnoreExecuteResult, setIgnorePostprocessResult, setName, setNameKey, setOptional
private java.lang.String catalogKey
private java.lang.String parameter
public java.lang.String getCatalogKey()
Return the context key under which our Catalog
has been
stored.
public void setCatalogKey(java.lang.String catalogKey)
Set the context key under which our Catalog
has been
stored.
catalogKey
- The new catalog keypublic java.lang.String getParameter()
Return the name of the request parameter to use for
selecting the Command
to be executed.
public void setParameter(java.lang.String parameter)
Set the name of the request parameter to use for
selecting the Command
to be executed.
parameter
- The new parameter nameprotected java.lang.String getCommandName(Context context)
Look up the specified request paramater for this request, and use it
to select an appropriate Command
to be executed.
getCommandName
in class LookupCommand
context
- Context for the current requestCommand
instanceprotected Catalog getCatalog(Context context)
getCatalog
in class LookupCommand
context
- Context
for this requestjava.lang.IllegalArgumentException
- if no Catalog
can be found