| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Action com.ibm.portal.struts.action.StrutsAction com.ibm.portal.struts.action.DispatchAction
public abstract class DispatchAction
This is a Portal friendly version of DispatchAction. The basic difference is the request object is a PortletRequest object and there is no response object.
Derived from the Struts DispatchAction javadoc:
An abstract Action that dispatches to a public
method that is named by the request parameter whose name is specified
by the parameter
property of the corresponding
ActionMapping. This Action is useful for developers who prefer to
combine many similar actions into a single Action class, in order to
simplify their application design.
To configure the use of this action in your
struts-config.xml
file, create an entry like this:
<action path="/saveSubscription"
type="org.apache.struts.actions.DispatchAction"
name="subscriptionForm"
scope="request"
input="/subscription.jsp"
parameter="method"/>
which will use the value of the request parameter named "method" to pick the appropriate "execute" method, which must have the same signature (other than method name) of the standard Action.execute method. For example, you might have the following three methods in the same action:
and call one of the methods with a URL like this:
<html:link action="/saveSubscription.do?method=update">
NOTE - All of the other mapping characteristics of
this action must be shared by the various handlers. This places some
constraints over what types of handlers may reasonably be packaged into
the same DispatchAction
subclass.
Field Summary | |
---|---|
protected java.lang.Class | clazz
The Class instance of this DispatchAction class.
|
protected static Log | log
Commons Logging instance. |
protected static MessageResources | messages
The message resources for this package. |
protected java.util.HashMap | methods
The set of Method objects introspected for this class, keyed by method name. |
protected java.lang.Class[] | types
The set of argument type classes for the reflected method call. |
Constructor Summary | |
---|---|
DispatchAction()
DispatchAction constructor. |
Method Summary | |
---|---|
protected ActionForward | ActionRequest, ActionResponse, java.lang.String)">dispatchMethod(ActionMapping mapping,
ActionForm form,
ActionRequest request,
ActionResponse response,
java.lang.String name)
Dispatches to the specified method. |
ActionForward | ActionRequest, ActionResponse)">execute(ActionMapping mapping,
ActionForm form,
ActionRequest request,
ActionResponse response)
Processes the current request based on the ActionMapping information. |
protected java.lang.reflect.Method | getMethod(java.lang.String name)
Introspect the current class to identify a method of the specified name that accepts the same parameter types as the execute
method does.
|
protected ActionForward | unspecified(ActionMapping mapping,
ActionForm form,
ActionRequest request)
Method which is dispatched to when there is no value for specified request parameter included in the request. |
Methods inherited from class com.ibm.portal.struts.action.StrutsAction |
---|
sendError, sendError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Class clazz
DispatchAction
class.
protected static Log log
protected static MessageResources messages
protected java.util.HashMap methods
The set of Method objects introspected for this class, keyed by method name. This collection is populated as different methods are called, so that introspection needs to occur only once per method name.
Derived from the Struts DispatchAction javadoc.
protected java.lang.Class[] types
The set of argument type classes for the reflected method call. These are the same for all calls, so calculate them only once.
Derived from the Struts DispatchAction javadoc.
Constructor Detail |
---|
public DispatchAction()
Method Detail |
---|
public ActionForward execute(ActionMapping mapping, ActionForm form, ActionRequest request, ActionResponse response) throws java.lang.Exception
null
return value will stop the request
processing, but will not result in the creation of a new IViewCommand
protected ActionForward unspecified(ActionMapping mapping, ActionForm form, ActionRequest request) throws java.lang.Exception
Method which is dispatched to when there is no value for specified
request parameter included in the request. Subclasses of
DispatchAction
should override this method if they wish
to provide default behavior different than producing an HTTP
"Bad Request" error.
Derived from the Struts DispatchAction javadoc
null
protected ActionForward dispatchMethod(ActionMapping mapping, ActionForm form, ActionRequest request, ActionResponse response, java.lang.String name) throws java.lang.Exception
protected java.lang.reflect.Method getMethod(java.lang.String name) throws java.lang.NoSuchMethodException
Introspect the current class to identify a method of the specified
name that accepts the same parameter types as the execute
method does.
Derived from the Struts DispatchAction javadoc.
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |