Package org.apache.struts.dispatcher
Class AbstractParameterDispatcher
java.lang.Object
org.apache.struts.dispatcher.AbstractDispatcher
org.apache.struts.dispatcher.AbstractParameterDispatcher
- All Implemented Interfaces:
Serializable
,Dispatcher
- Direct Known Subclasses:
ServletParameterDispatcher
This abstract class is a template for choosing the target method that is
identified by a submission parameter.
- Since:
- Struts 1.4
- Version:
- $Rev$
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
The default parameter name if no parameter is set.Fields inherited from class org.apache.struts.dispatcher.AbstractDispatcher
CANCELLED_METHOD_NAME, EXECUTE_METHOD_NAME
-
Constructor Summary
ConstructorDescriptionAbstractParameterDispatcher
(MethodResolver methodResolver) Constructs a new dispatcher with the specified method resolver. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Retrieves the name of the parameter to fallback upon if the action configuration did not set theparameter
attribute.protected String
getParameter
(ActionContext context) Retrieves the parameter name whose value will identity the intended method to dispatch.protected final String
resolveMethodName
(ActionContext context) protected abstract String
resolveParameterValue
(ActionContext context, String parameter) Extracts the value that is keyed by the specified parameter.Methods inherited from class org.apache.struts.dispatcher.AbstractDispatcher
dispatch, dispatchMethod, getDefaultMethodName, getMethod, invoke, isCancelled, unspecified
-
Field Details
-
DEFAULT_PARAMETER_NAME
The default parameter name if no parameter is set.- See Also:
-
-
Constructor Details
-
AbstractParameterDispatcher
Constructs a new dispatcher with the specified method resolver.- Parameters:
methodResolver
- the method resolver
-
-
Method Details
-
getDefaultParameterName
Retrieves the name of the parameter to fallback upon if the action configuration did not set theparameter
attribute. The default implementation returnsDEFAULT_PARAMETER_NAME
.- Returns:
- the fallback parameter name; can be
null
- See Also:
-
getParameter
Retrieves the parameter name whose value will identity the intended method to dispatch. The value is not necessarily a method name, but a key that can resolve to one. The default implementation returns the mapping'sparameter
attribute; otherwise fallback to the default parameter name.- Parameters:
context
- the current action context- Returns:
- the mapping's parameter name
- See Also:
-
resolveMethodName
-
resolveParameterValue
Extracts the value that is keyed by the specified parameter.- Parameters:
context
- the current action contextparameter
- the parameter name- Returns:
- the parameter value
-