org.apache.struts.faces.application
Class FacesRequestProcessor

java.lang.Object
  |
  +--org.apache.struts.action.RequestProcessor
        |
        +--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:
$Revision: 1.2 $ $Date: 2003/06/04 17:38:13 $
Author:
Craig R. McClanahan

Field Summary
protected static org.apache.commons.logging.Log log
          The log instance for this class.
 
Fields inherited from class org.apache.struts.action.RequestProcessor
actions, appConfig, 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)
          Do a forward to specified uri using request dispatcher.
protected  void doInclude(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Do a include to specified uri using request dispatcher.
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.
private  void selectTree(javax.faces.context.FacesContext context, java.lang.String uri)
          Select the response component tree that corresponds to the specified URI, which is being forwarded to or included.
 
Methods inherited from class org.apache.struts.action.RequestProcessor
destroy, getDebug, getInternal, getServletContext, init, internalModuleRelativeForward, internalModuleRelativeInclude, log, log, process, processActionCreate, processActionForm, processActionForward, processActionPerform, processContent, processException, processForward, processForwardConfig, processInclude, processLocale, processMapping, processMultipart, processNoCache, processPreprocess, processRoles, processValidate
 
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.

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

Do a forward to specified uri using request dispatcher. This method is used by all internal method needing to transfer control to a new resource to create the response. For a Faces request, select the new response component tree in addition to the standard processing.

Overrides:
doForward in class org.apache.struts.action.RequestProcessor
Parameters:
uri - Uri or Definition name to forward
request - Current page request
response - Current page response
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

Do a include to specified uri using request dispatcher. This method is used by all internal method needing to transfer control to a new resource to create the response. For a Faces request, select the new response component tree in addition to the standard processing.

Overrides:
doInclude in class org.apache.struts.action.RequestProcessor
Parameters:
uri - Uri or Definition name to forward
request - Current page request
response - Current page response
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()

selectTree

private void selectTree(javax.faces.context.FacesContext context,
                        java.lang.String uri)

Select the response component tree that corresponds to the specified URI, which is being forwarded to or included.

Parameters:
context - FacesContext for the request we are processing
uri - Context-relative URI of the new resource


Copyright © 2003 - Apache Software Foundation