Overview  Package   Class  Tree  Serialized  Deprecated  Index  Help 

com.ibm.wps.portlets.struts
Class WpsRequestProcessor

java.lang.Object
  extended byorg.apache.struts.action.RequestProcessor
      extended bycom.ibm.wps.portlets.struts.WpsRequestProcessor
Direct Known Subclasses:
WpsStrutsTilesRequestProcessor

public class WpsRequestProcessor
extends org.apache.struts.action.RequestProcessor

WpsRequestProcessor contains the processing logic that the Struts controller portlet performs as it receives each request from the container. The WpsRequestProcessor is a customized version of the base Struts RequestProcessor that allows the Struts application to execute in Portal. This class or subclasses must be the Struts request processor used for Struts applications in portal. The WpsRequestProcessor class can be extended to support customizing the Struts processing in Portal, but the super method implementations should be invoked.

Since:
4.1

Field Summary
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 the Struts Portlet Framework.
 

Fields inherited from class org.apache.struts.action.RequestProcessor
actions, appConfig, INCLUDE_PATH_INFO, INCLUDE_SERVLET_PATH, moduleConfig, servlet
 

Constructor Summary
WpsRequestProcessor()
          WpsRequestProcessor constructor.
 

Method Summary
protected  void doForward(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Calls doInclude.
protected  void doInclude(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Includes a specified URI.
 java.lang.String getApplicationPrefix()
          Gets the application prefix associated with this command processor.
protected  com.ibm.wps.struts.common.ModuleContext getModuleContext()
          Returns the module context object.
protected  javax.servlet.ServletContext getServletContext()
          Returns the servlet context object.
 WpsStrutsInfo getStrutsInfo()
          Gets the WpsStrutsInfo object associated with this command processor.
 void init(org.apache.struts.action.ActionServlet servlet, org.apache.struts.config.ModuleConfig moduleConfig)
          Initializes this request processor instance.
protected  org.apache.struts.action.ActionForward processActionPerform(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.Action action, org.apache.struts.action.ActionForm form, org.apache.struts.action.ActionMapping mapping)
          Asks the specified Action instance to handle this request.
protected  org.apache.struts.action.ActionForward processException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Exception exception, org.apache.struts.action.ActionForm form, org.apache.struts.action.ActionMapping mapping)
          Calls the super implementation.
protected  void processForwardConfig(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.config.ForwardConfig forward)
          Processes the ForwardConfig and then calls doFoward.
protected  org.apache.struts.action.ActionMapping processMapping(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String path)
          Calls the super processMapping implementation.
protected  javax.servlet.http.HttpServletRequest processMultipart(javax.servlet.http.HttpServletRequest request)
          If this is a multipart request, wrap it with a special wrapper.
static void processNewActionUri(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
          Simulates a forward to a Struts action.
protected  void processNoCache(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method is overridden so that the Struts request processor processNoCache method is not called.
protected  void processPopulate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionForm form, org.apache.struts.action.ActionMapping mapping)
          Calls the inherited processPopulate.
protected  boolean processRoles(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
          Calls the super implementation for processing J2EE roles.
protected  java.lang.String processUri(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Identifies and returns the path component from the request URI.
 void setServletContext(javax.servlet.ServletContext sContext)
          Sets the servlet context.
 

Methods inherited from class org.apache.struts.action.RequestProcessor
destroy, getDebug, getInternal, internalModuleRelativeForward, internalModuleRelativeInclude, log, log, process, processActionCreate, processActionForm, processActionForward, processContent, processForward, processInclude, processLocale, processPath, processPreprocess, processValidate
 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messages

protected static org.apache.struts.util.MessageResources messages
The message resources for the Struts Portlet Framework.


log

protected static org.apache.commons.logging.Log log
The commons-logging instance for this class.

Constructor Detail

WpsRequestProcessor

public WpsRequestProcessor()
WpsRequestProcessor constructor.

Method Detail

processMultipart

protected javax.servlet.http.HttpServletRequest processMultipart(javax.servlet.http.HttpServletRequest request)
If this is a multipart request, wrap it with a special wrapper. Otherwise, return the request unchanged.

Parameters:
request - The HttpServletRequest we are processing
Returns:
HttpServletRequest the wrappered request object if a multipart request

init

public void init(org.apache.struts.action.ActionServlet servlet,
                 org.apache.struts.config.ModuleConfig moduleConfig)
          throws javax.servlet.ServletException
Initializes this request processor instance.

Parameters:
servlet - The ActionServlet we are associated with
moduleConfig - The ModuleConfig we are associated with.
Throws:
javax.servlet.ServletException - If an error occurs during initialization

getModuleContext

protected com.ibm.wps.struts.common.ModuleContext getModuleContext()
Returns the module context object.

Returns:
returns the ModuleContext object

processActionPerform

protected org.apache.struts.action.ActionForward processActionPerform(javax.servlet.http.HttpServletRequest request,
                                                                      javax.servlet.http.HttpServletResponse response,
                                                                      org.apache.struts.action.Action action,
                                                                      org.apache.struts.action.ActionForm form,
                                                                      org.apache.struts.action.ActionMapping mapping)
                                                               throws java.io.IOException,
                                                                      javax.servlet.ServletException
Asks the specified Action instance to handle this request. Return the ActionForward instance (if any) returned by the called Action for further processing. This implementation will also check for the Portal friendly StrutsAction class and call the execute method with the portlet objects instead of the http servlet interfaces.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
action - The Action instance to be used
form - The ActionForm instance to pass to this Action
mapping - The ActionMapping instance to pass to this Action
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processForwardConfig

protected void processForwardConfig(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    org.apache.struts.config.ForwardConfig forward)
                             throws java.io.IOException,
                                    javax.servlet.ServletException
Processes the ForwardConfig and then calls doFoward. Redirects are not supported, and instead are handled as a forward. The path is modified as necessary depending on the context-relative setting and the path is then passed into doForward.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
forward - The ActionForward controlling where we go next
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processException

protected org.apache.struts.action.ActionForward processException(javax.servlet.http.HttpServletRequest request,
                                                                  javax.servlet.http.HttpServletResponse response,
                                                                  java.lang.Exception exception,
                                                                  org.apache.struts.action.ActionForm form,
                                                                  org.apache.struts.action.ActionMapping mapping)
                                                           throws java.io.IOException,
                                                                  javax.servlet.ServletException
Calls the super implementation. If the exception is not handled and is a WpsStrutsException then response.sendError with the exception information is called.

Parameters:
request - The servlet request we are processing
response - The servlet response we are processing
exception - The exception being handled
form - The ActionForm we are processing
mapping - The ActionMapping we are using
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processMapping

protected org.apache.struts.action.ActionMapping processMapping(javax.servlet.http.HttpServletRequest request,
                                                                javax.servlet.http.HttpServletResponse response,
                                                                java.lang.String path)
                                                         throws java.io.IOException
Calls the super processMapping implementation. It then checks the ActionMapping type to see if the Action implements the IStrutsPrepareRender interface. If so, the request processor processing stops.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
path - The portion of the request URI for selecting a mapping
Throws:
java.io.IOException - if an input/output error occurs

processNoCache

protected void processNoCache(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
This method is overridden so that the Struts request processor processNoCache method is not called. This method is a no-op in Portal.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating

doForward

protected void doForward(java.lang.String uri,
                         javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response)
                  throws java.io.IOException,
                         javax.servlet.ServletException
Calls doInclude. Forwards are not directly supported in Portal.

Parameters:
uri - Uri or Definition name to forward
request - Current page request
response - Current page response
Throws:
java.io.IOException
javax.servlet.ServletException

doInclude

protected void doInclude(java.lang.String uri,
                         javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response)
                  throws java.io.IOException,
                         javax.servlet.ServletException
Includes a specified URI. This implementation includes files, or recursively calls the RequestProcessor for Struts actions.

Parameters:
uri - Uri of page to include
request - Current page request
response - Current page response
Throws:
java.io.IOException
javax.servlet.ServletException

processNewActionUri

public static void processNewActionUri(java.lang.String uri,
                                       javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response,
                                       javax.servlet.ServletContext servletContext)
                                throws java.io.IOException,
                                       javax.servlet.ServletException
Simulates a forward to a Struts action. The appropriate Request Processor is looked up and the process method is called. The URI is the path for the Struts action and can contain a query string. If the URI is not a path for a Struts action, then the URI will be passed to the ViewCommandFactory.

Parameters:
uri - the new URI
request - the request
response - the response
Throws:
java.io.IOException
javax.servlet.ServletException

setServletContext

public void setServletContext(javax.servlet.ServletContext sContext)
Sets the servlet context.

Parameters:
sContext - the servlet context object

getServletContext

protected javax.servlet.ServletContext getServletContext()
Returns the servlet context object.

Returns:
returns the servlet context object, can be null if not set

getStrutsInfo

public WpsStrutsInfo getStrutsInfo()
Gets the WpsStrutsInfo object associated with this command processor.

Returns:
returns the WpsStrutsInfo object

getApplicationPrefix

public java.lang.String getApplicationPrefix()
Gets the application prefix associated with this command processor.

Returns:
returns the application prefix, can be null

processRoles

protected boolean processRoles(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response,
                               org.apache.struts.action.ActionMapping mapping)
                        throws java.io.IOException,
                               javax.servlet.ServletException
Calls the super implementation for processing J2EE roles. If the application was configured to use Portal groups instead then the ActionMapping roles are compared to the user's Portal groups.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
mapping - The mapping we are using
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processPopulate

protected void processPopulate(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response,
                               org.apache.struts.action.ActionForm form,
                               org.apache.struts.action.ActionMapping mapping)
                        throws javax.servlet.ServletException
Calls the inherited processPopulate. If file upload is used and the maximum length is exceeded then this method gets the request input stream and reads the byte stream.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
form - The ActionForm instance we are populating
mapping - The ActionMapping we are using
Throws:
javax.servlet.ServletException - if thrown by RequestUtils.populate()

processUri

protected java.lang.String processUri(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws java.io.IOException
Identifies and returns the path component from the request URI. The path includes the extension mapping. If no such path can be identified, it creates an error response and returns null.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs

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.