Overview  Package   Class  Tree  Serialized  Deprecated  Index  Help 

com.ibm.wps.struts.action
Class StrutsAction

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended bycom.ibm.wps.struts.action.StrutsAction
Direct Known Subclasses:
WpsDispatchAction

public class StrutsAction
extends org.apache.struts.action.Action

A StrutsAction is an adapter between the contents of an incoming portlet request and the corresponding business logic that should be executed to process this request. The controller (WpsStrutsActionServlet) will select an appropriate StrutsAction for each request, create an instance (if necessary), and call the execute method.

StrutsActions must be programmed in a thread-safe manner, because the controller will share the same instance for multiple simultaneous requests. This means design with the following items in mind:

  • Instance and static variables MUST NOT be used to store information related to the state of a particular request. They MAY be used to share global resources across requests for the same action.
  • Access to other resources (JavaBeans, session variables, etc.) MUST be synchronized if those resources require protection. (Generally, however, resource classes should be designed to provide their own protection where necessary.

When a StrutsAction instance is first created, the controller servlet will call setServlet() with a non-null argument to identify the controller servlet instance to which this Action is attached. When the controller servlet is to be shut down (or restarted), the setServlet() method will be called with a null argument, which can be used to clean up any allocated resources in use by this Action.

The StrutsAction is a Portal friendly action to which the portlet objects are passed directly. This is the preferred interface for Struts applications that do not need to support the servlet environment.

Since:
4.1

Field Summary
 

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
StrutsAction()
          Constructor for this class.
 

Method Summary
 org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Deprecated. Use execute method taking mapping, form, request arguments only
 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.
 org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, org.apache.jetspeed.portlet.PortletRequest request, org.apache.jetspeed.portlet.PortletResponse response)
          Processes the current request based on the ActionMapping information.
 org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
          Deprecated. Use execute method taking mapping, form, request arguments only
 void sendError(org.apache.jetspeed.portlet.PortletRequest portletRequest, int sc)
          Sends an error response to the client using the specified status.
 void sendError(org.apache.jetspeed.portlet.PortletRequest portletRequest, int sc, java.lang.String msg)
          Sends an error response to the client using the specified status code and descriptive message.
 

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
 

Constructor Detail

StrutsAction

public StrutsAction()
Constructor for this class.

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.

Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The PortletRequest we are processing
Returns:
returns the ActionForward object, can be null
Throws:
java.lang.Exception - if the application business logic throws an exception

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,
                                                      org.apache.jetspeed.portlet.PortletResponse response)
                                               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 passes the response object and will be called if the Action implements the IStrutsPrepareRender interface. A null return value will stop the request processing, but will not result in the creation of a new IViewCommand.

Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The PortletRequest we are processing
response - The PortletResponse we are processing
Returns:
returns the ActionForward object, can be null
Throws:
java.lang.Exception - if the application business logic throws an exception

execute

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
                                                      org.apache.struts.action.ActionForm form,
                                                      javax.servlet.ServletRequest request,
                                                      javax.servlet.ServletResponse response)
                                               throws java.lang.Exception
Deprecated. Use execute method taking mapping, form, request arguments only

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.

Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The non-HTTP request we are processing
response - The non-HTTP response we are creating
Returns:
returns the ActionForward object, can be null
Throws:
java.lang.Exception - if the application business logic throws an exception

execute

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
                                                      org.apache.struts.action.ActionForm form,
                                                      javax.servlet.http.HttpServletRequest request,
                                                      javax.servlet.http.HttpServletResponse response)
                                               throws java.lang.Exception
Deprecated. Use execute method taking mapping, form, request arguments only

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.

Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The HTTP request we are processing
response - The HTTP response we are creating
Returns:
returns the ActionForward object, can be null
Throws:
java.lang.Exception - if the application business logic throws an exception

sendError

public void sendError(org.apache.jetspeed.portlet.PortletRequest portletRequest,
                      int sc,
                      java.lang.String msg)
               throws java.io.IOException
Sends an error response to the client using the specified status code and descriptive message. The server generally formats the response to look like a normal server error page.

Parameters:
portletRequest - the PortletRequest this error report is associated with
sc - the error status code
msg - the descriptive message
Throws:
java.io.IOException - if there is a problem saving the error information

sendError

public void sendError(org.apache.jetspeed.portlet.PortletRequest portletRequest,
                      int sc)
               throws java.io.IOException
Sends an error response to the client using the specified status. The server generally formats the response to look like a normal server error page.

Parameters:
portletRequest - the PortletRequest this error report is associated with
sc - the error status code
Throws:
java.io.IOException - if there is a problem saving the error information

Overview  Package   Class  Tree  Serialized  Deprecated  Index  Help 

 

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.