Overview Package Class Tree Serialized Deprecated Index Help PREV class NEXT class SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
com.ibm.wps.struts.action
Class WpsDispatchActionjava.lang.Object org.apache.struts.action.Action com.ibm.wps.struts.action.StrutsAction com.ibm.wps.struts.action.WpsDispatchAction
- Direct Known Subclasses:
- WpsLookupDispatchAction
- public abstract class WpsDispatchAction
- extends StrutsAction
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.
The following are comments 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. This 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:
- public ActionForward delete(ActionMapping mapping, ActionForm form, PortletRequest request ) throws Exception
- public ActionForward insert(ActionMapping mapping, ActionForm form, PortletRequest request) throws Exception
- public ActionForward update(ActionMapping mapping, ActionForm form, PortletRequest request) throws Exception
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.
- Since:
- 5.0
Field Summary protected java.lang.Class clazz
The Class instance of this DispatchAction class.protected static org.apache.commons.logging.Log log
The commons-logging instance for this class.protected static org.apache.struts.util.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.
Fields inherited from class org.apache.struts.action.Action ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY
Constructor Summary WpsDispatchAction()
WpsDispatchAction constructor.
Method Summary protected org.apache.struts.action.ActionForward dispatchMethod(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, org.apache.jetspeed.portlet.PortletRequest request, java.lang.String name)
Dispatches to the specified method.org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, org.apache.jetspeed.portlet.PortletRequest request)
Processes the current request based on the ActionMapping information.protected java.lang.reflect.Method getMethod(java.lang.String name)
Introspects the current class to identify a method of the specified name that accepts the same parameter types as theexecute method does.
protected org.apache.struts.action.ActionForward unspecified(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, org.apache.jetspeed.portlet.PortletRequest request)
Method which is dispatched to when there is no value for a specified request parameter included in the request.
Methods inherited from class com.ibm.wps.struts.action.StrutsAction execute, execute, execute, sendError, sendError
Methods inherited from class org.apache.struts.action.Action generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex
Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail clazz
protected java.lang.Class clazz
- The Class instance of this DispatchAction class.
log
protected static org.apache.commons.logging.Log log
- The commons-logging instance for this class.
messages
protected static org.apache.struts.util.MessageResources messages
- The message resources for this package.
methods
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. Introspection needs to occur only once per method name.
types
protected java.lang.Class[] types
- The set of argument type classes for the reflected method call. These are the same for all calls and only need to be calculated once.
Constructor Detail WpsDispatchAction
public WpsDispatchAction()
- WpsDispatchAction constructor.
Method Detail execute
public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, org.apache.jetspeed.portlet.PortletRequest request) throws java.lang.Exception
- Processes the current request based on the ActionMapping information. The processing should return an ActionForward, to control the processing. This implementation does not allow the response object to be written to directly, so an ActionForward should be returned. A
null return value will stop the request processing, but will not result in the creation of a new IViewCommand.
- Overrides:
- execute in class StrutsAction
- Parameters:
- mapping - The ActionMapping used to select this instance
- form - The optional ActionForm bean for this request (if any)
- request - The portlet request we are processing
- Returns:
- ActionForward the action forward for the mapping parameter
- Throws:
- java.lang.Exception - if an exception occurs
unspecified
protected org.apache.struts.action.ActionForward unspecified(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, org.apache.jetspeed.portlet.PortletRequest request) throws java.lang.Exception
- Method which is dispatched to when there is no value for a 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.
- Parameters:
- mapping - The ActionMapping used to select this instance
- form - The optional ActionForm bean for this request (if any)
- request - The portlet request we are processing
- Returns:
- ActionForward the action forward for the unspecified case
- Throws:
- java.lang.Exception - if an exception occurs
dispatchMethod
protected org.apache.struts.action.ActionForward dispatchMethod(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, org.apache.jetspeed.portlet.PortletRequest request, java.lang.String name) throws java.lang.Exception
- Dispatches to the specified method.
- Parameters:
- mapping - The ActionMapping used to select this instance
- form - The optional ActionForm bean for this request (if any)
- request - The portlet request we are processing
- name - the dispatch name
- Returns:
- ActionForward the action forward for the specified name
- Throws:
- java.lang.Exception - if an exception occurs
getMethod
protected java.lang.reflect.Method getMethod(java.lang.String name) throws java.lang.NoSuchMethodException
- Introspects the current class to identify a method of the specified name that accepts the same parameter types as the
execute method does.
- Parameters:
- name - Name of the method to be introspected
- Returns:
- Method the method object for the specified name
- Throws:
- java.lang.NoSuchMethodException - if no such method can be found
Overview Package Class Tree Serialized Deprecated Index Help PREV class NEXT class SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.