org.apache.struts.faces.application
Class FacesRequestProcessor

java.lang.Object
  extended by org.apache.struts.action.RequestProcessor
      extended by org.apache.struts.faces.application.FacesRequestProcessor

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

Concrete implementation of RequestProcessor that implements the standard Struts request processing lifecycle on a request that was received as an ActionEvent by our associated ActionListener. It replaces the request processor instance normally configured by Struts, so it must support non-Faces requests as well.

Version:
$Rev: 473326 $ $Date: 2006-11-10 06:58:06 -0600 (Fri, 10 Nov 2006) $

Field Summary
static java.lang.String LIFECYCLE_ID_ATTR
          The lifecycle id.
protected static org.apache.commons.logging.Log log
          The log instance for this class.
 
Fields inherited from class org.apache.struts.action.RequestProcessor
actions, INCLUDE_PATH_INFO, INCLUDE_SERVLET_PATH, moduleConfig, servlet
 
Constructor Summary
FacesRequestProcessor()
           
 
Method Summary
protected  void doForward(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Set up a Faces Request if we are not already processing one.
protected  org.apache.struts.action.Action processActionCreate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
           
protected  org.apache.struts.action.ActionForm processActionForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
           
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)
           
protected  boolean processForward(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
           
protected  void processForwardConfig(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.config.ForwardConfig forward)
           
protected  boolean processInclude(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
           
protected  java.lang.String processPath(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Identify and return the path component (from the request URI for a non-Faces request, or from the form event for a Faces request) that we will use to select an ActionMapping to dispatch with.
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)
          Populate the properties of the specified ActionForm instance from the request parameters included with this request, IF this is a non-Faces request.
protected  boolean processValidate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionForm form, org.apache.struts.action.ActionMapping mapping)
           
 
Methods inherited from class org.apache.struts.action.RequestProcessor
destroy, doInclude, getInternal, getServletContext, init, internalModuleRelativeForward, internalModuleRelativeInclude, process, processCachedMessages, processContent, processException, processLocale, processMapping, processMultipart, processNoCache, processPreprocess, processRoles
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

The log instance for this class.


LIFECYCLE_ID_ATTR

public static final java.lang.String LIFECYCLE_ID_ATTR

The lifecycle id.

See Also:
Constant Field Values
Constructor Detail

FacesRequestProcessor

public FacesRequestProcessor()
Method Detail

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

Set up a Faces Request if we are not already processing one. Next, create a new view if the specified uri is different from the current view identifier. Finally, cause the new view to be rendered, and call FacesContext.responseComplete() to indicate that this has already been done.

Overrides:
doForward in class org.apache.struts.action.RequestProcessor
Parameters:
uri - Context-relative path to forward to
request - Current page request
response - Current page response
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet error occurs

processActionCreate

protected org.apache.struts.action.Action processActionCreate(javax.servlet.http.HttpServletRequest request,
                                                              javax.servlet.http.HttpServletResponse response,
                                                              org.apache.struts.action.ActionMapping mapping)
                                                       throws java.io.IOException
Overrides:
processActionCreate in class org.apache.struts.action.RequestProcessor
Throws:
java.io.IOException

processActionForm

protected org.apache.struts.action.ActionForm processActionForm(javax.servlet.http.HttpServletRequest request,
                                                                javax.servlet.http.HttpServletResponse response,
                                                                org.apache.struts.action.ActionMapping mapping)
Overrides:
processActionForm in class org.apache.struts.action.RequestProcessor

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
Overrides:
processActionPerform in class org.apache.struts.action.RequestProcessor
Throws:
java.io.IOException
javax.servlet.ServletException

processForward

protected boolean processForward(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 org.apache.struts.action.ActionMapping mapping)
                          throws java.io.IOException,
                                 javax.servlet.ServletException
Overrides:
processForward in class org.apache.struts.action.RequestProcessor
Throws:
java.io.IOException
javax.servlet.ServletException

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
Overrides:
processForwardConfig in class org.apache.struts.action.RequestProcessor
Throws:
java.io.IOException
javax.servlet.ServletException

processInclude

protected boolean processInclude(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 org.apache.struts.action.ActionMapping mapping)
                          throws java.io.IOException,
                                 javax.servlet.ServletException
Overrides:
processInclude in class org.apache.struts.action.RequestProcessor
Throws:
java.io.IOException
javax.servlet.ServletException

processPath

protected java.lang.String processPath(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
                                throws java.io.IOException

Identify and return the path component (from the request URI for a non-Faces request, or from the form event for a Faces request) that we will use to select an ActionMapping to dispatch with. If no such path can be identified, create an error response and return null.

Overrides:
processPath in class org.apache.struts.action.RequestProcessor
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

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

Populate the properties of the specified ActionForm instance from the request parameters included with this request, IF this is a non-Faces request. For a Faces request, this will have already been done by the Update Model Values phase of the request processing lifecycle, so all we have to do is recognize whether the request was cancelled or not.

Overrides:
processPopulate in class org.apache.struts.action.RequestProcessor
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()

processValidate

protected boolean processValidate(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response,
                                  org.apache.struts.action.ActionForm form,
                                  org.apache.struts.action.ActionMapping mapping)
                           throws java.io.IOException,
                                  javax.servlet.ServletException,
                                  org.apache.struts.action.InvalidCancelException
Overrides:
processValidate in class org.apache.struts.action.RequestProcessor
Throws:
java.io.IOException
javax.servlet.ServletException
org.apache.struts.action.InvalidCancelException


Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.