|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ervacon.springframework.web.servlet.mvc.webflow.MultiAction
Action implementation that bundles many action execution methods into a single action implementation class. Action execution methods defined by subclasses should follow the following signature:
public String executeMethodName(HttpServletRequest request, HttpServletResponse response, Map model)By default, the executeMethodName will be the name of the current state of the flow, so the follow state definition
<action-state id="search"> <action name="searchAct" bean="myMultiAction"/> <transition name="searchAct.ok" to="results"/> </action-state>will execute the method
public String search(HttpServletRequest request, HttpServletResponse response, Map model)Note that action execution methods should not throw checked exceptions! They should signal an appropriate event or wrap the exception in a runtime exception.
A typical use of the MultiAction is to combine all CRUD operations for a certain domain object into a single controller. This action also allows you to reduce the number of action beans you have to configure in the application context
Exposed configuration properties:
| name | default | description |
| delegate | this | The delegate object holding the execution methods. |
| Field Summary |
| Fields inherited from interface com.ervacon.springframework.web.servlet.mvc.webflow.Action |
ERROR, OK |
| Constructor Summary | |
MultiAction()
|
|
| Method Summary | |
java.lang.String |
execute(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.util.Map model)
Execute the action and return and signal an event that allows the containing flow to continue. |
protected java.lang.String |
getCurrentState(javax.servlet.http.HttpServletRequest request,
java.util.Map model)
Get the name of the current state of the flow executing this action. |
protected java.lang.Object |
getDelegate()
Returns the delegate object holding the execution methods. |
protected java.lang.reflect.Method |
getExecuteMethod(java.lang.String executeMethodName)
Get the action execution method with given name on the delegate object. |
protected java.lang.String |
getExecuteMethodName(java.lang.String currentState)
Derive the name of an execution method from the name of the current state of the web flow. |
protected void |
setDelegate(java.lang.Object delegate)
Set the delegate object holding the execution methods. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MultiAction()
| Method Detail |
protected java.lang.Object getDelegate()
Returns the delegate object holding the execution methods. Defaults to this object.
protected void setDelegate(java.lang.Object delegate)
Set the delegate object holding the execution methods.
delegate - The delegate to set.
protected java.lang.String getCurrentState(javax.servlet.http.HttpServletRequest request,
java.util.Map model)
Get the name of the current state of the flow executing this action.
The default implementation uses the
WebFlowUtils.getWebFlowMementoStack(HttpServletRequest, Map)
method, and thus assumes that the web flow id is available under its
default id WebFlowController.FLOW_ID_MODEL_NAME in the model.
If you have used WebFlowController.setFlowIdModelName(String)
to change the name of the flow id in the model, redefine this method
and call WebFlowUtils.getWebFlowMementoStack(HttpServletRequest, Map, String)
with the correct name.
request - current HTTP requestmodel - model of the flow
protected java.lang.String getExecuteMethodName(java.lang.String currentState)
Derive the name of an execution method from the name of the current state of the web flow.
The default implementation just uses the name of the current state as execution method name.
currentState - the name of the current state of the flow
protected java.lang.reflect.Method getExecuteMethod(java.lang.String executeMethodName)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException
Get the action execution method with given name on the delegate object. Execution methods should be of the form:
public String executeMethodName(HttpServletRequest request, HttpServletResponse response, Map model)
executeMethodName - name of the execution method
java.lang.NoSuchMethodException - when the method cannot be found on the delegate
java.lang.IllegalAccessException - when the method is not accessible on the delegate
public java.lang.String execute(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.util.Map model)
ActionExecute the action and return and signal an event that allows the containing flow to continue. A null return value is not allowed: an action must return a valid event!
Note that actions cannot throw checked exceptions. They should signal an appropriate event or wrap the exception in a runtime exception.
execute in interface Actionrequest - current HTTP requestresponse - current HTTP responsemodel - model of the flow
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||