Class FacesRequestProcessor
- All Implemented Interfaces:
Serializable
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$ $Date$
- See Also:
-
Field Summary
FieldsFields inherited from class org.apache.struts.action.RequestProcessor
actions, INCLUDE_PATH_INFO, INCLUDE_SERVLET_PATH, moduleConfig, servlet -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoForward(String uri, HttpServletRequest request, HttpServletResponse response) Set up a Faces Request if we are not already processing one.protected ActionprocessActionCreate(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) Return anActioninstance that will be used to process the current request, creating a new one if necessary.protected ActionFormprocessActionForm(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) Retrieve and return theActionFormassociated with this mapping, creating and retaining one if necessary.protected ActionForwardprocessActionPerform(HttpServletRequest request, HttpServletResponse response, Action action, ActionForm form, ActionMapping mapping) Ask the specifiedActioninstance to handle this request.protected booleanprocessForward(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) Process a forward requested by this mapping (if any).protected voidprocessForwardConfig(HttpServletRequest request, HttpServletResponse response, ForwardConfig forward) Forward or redirect to the specified destination, by the specified mechanism.protected booleanprocessInclude(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) Process an include requested by this mapping (if any).protected StringprocessPath(HttpServletRequest request, 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 voidprocessPopulate(HttpServletRequest request, HttpServletResponse response, ActionForm form, ActionMapping mapping) Populate the properties of the specifiedActionForminstance from the request parameters included with this request, IF this is a non-Faces request.protected booleanprocessValidate(HttpServletRequest request, HttpServletResponse response, ActionForm form, ActionMapping mapping) If this request was not cancelled, and the request'sActionMappinghas not disabled validation, call thevalidatemethod of the specifiedActionForm, and forward to the input path if there were any errors.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
-
Field Details
-
LIFECYCLE_ID_ATTR
The lifecycle id.
- See Also:
-
-
Constructor Details
-
FacesRequestProcessor
public FacesRequestProcessor()
-
-
Method Details
-
doForward
protected void doForward(String uri, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException Set up a Faces Request if we are not already processing one. Next, create a new view if the specified
uriis different from the current view identifier. Finally, cause the new view to be rendered, and callFacesContext.responseComplete()to indicate that this has already been done.- Overrides:
doForwardin classRequestProcessor- Parameters:
uri- Context-relative path to forward torequest- Current page requestresponse- Current page response- Throws:
IOException- if an input/output error occursServletException- if a servlet error occurs
-
processActionCreate
protected Action processActionCreate(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) throws IOException Description copied from class:RequestProcessorReturn an
Actioninstance that will be used to process the current request, creating a new one if necessary.- Overrides:
processActionCreatein classRequestProcessor- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creatingmapping- The mapping we are using- Returns:
- An
Actioninstance that will be used to process the current request. - Throws:
IOException- if an input/output error occurs
-
processActionForm
protected ActionForm processActionForm(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) Description copied from class:RequestProcessorRetrieve and return the
ActionFormassociated with this mapping, creating and retaining one if necessary. If there is noActionFormassociated with this mapping, returnnull.- Overrides:
processActionFormin classRequestProcessor- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creatingmapping- The mapping we are using- Returns:
- The
ActionFormassociated with this mapping.
-
processActionPerform
protected ActionForward processActionPerform(HttpServletRequest request, HttpServletResponse response, Action action, ActionForm form, ActionMapping mapping) throws IOException, ServletException Description copied from class:RequestProcessorAsk the specified
Actioninstance to handle this request. Return theActionForwardinstance (if any) returned by the calledActionfor further processing.- Overrides:
processActionPerformin classRequestProcessor- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creatingaction- The Action instance to be usedform- The ActionForm instance to pass to this Actionmapping- The ActionMapping instance to pass to this Action- Returns:
- The
ActionForwardinstance (if any) returned by the calledAction. - Throws:
IOException- if an input/output error occursServletException- if a servlet exception occurs
-
processForward
protected boolean processForward(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) throws IOException, ServletException Description copied from class:RequestProcessorProcess a forward requested by this mapping (if any). Return
trueif standard processing should continue, orfalseif we have already handled this request.- Overrides:
processForwardin classRequestProcessor- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creatingmapping- The ActionMapping we are using- Returns:
trueto continue normal processing;falseif a response has been created.- Throws:
IOException- if an input/output error occursServletException- if a servlet exception occurs
-
processForwardConfig
protected void processForwardConfig(HttpServletRequest request, HttpServletResponse response, ForwardConfig forward) throws IOException, ServletException Description copied from class:RequestProcessorForward or redirect to the specified destination, by the specified mechanism. This method uses a
ForwardConfigobject instead anActionForward.- Overrides:
processForwardConfigin classRequestProcessor- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creatingforward- The ForwardConfig controlling where we go next- Throws:
IOException- if an input/output error occursServletException- if a servlet exception occurs
-
processInclude
protected boolean processInclude(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) throws IOException, ServletException Description copied from class:RequestProcessorProcess an include requested by this mapping (if any). Return
trueif standard processing should continue, orfalseif we have already handled this request.- Overrides:
processIncludein classRequestProcessor- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creatingmapping- The ActionMapping we are using- Returns:
trueto continue normal processing;falseif a response has been created.- Throws:
IOException- if an input/output error occursServletException- if thrown by invoked methods
-
processPath
protected String processPath(HttpServletRequest request, HttpServletResponse response) throws 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:
processPathin classRequestProcessor- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creating- Returns:
- The path that will be used to select an action mapping.
- Throws:
IOException- if an input/output error occurs
-
processPopulate
protected void processPopulate(HttpServletRequest request, HttpServletResponse response, ActionForm form, ActionMapping mapping) throws ServletException Populate the properties of the specified
ActionForminstance 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:
processPopulatein classRequestProcessor- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creatingform- The ActionForm instance we are populatingmapping- The ActionMapping we are using- Throws:
ServletException- if thrown by RequestUtils.populate()
-
processValidate
protected boolean processValidate(HttpServletRequest request, HttpServletResponse response, ActionForm form, ActionMapping mapping) throws IOException, ServletException, InvalidCancelException Description copied from class:RequestProcessorIf this request was not cancelled, and the request's
ActionMappinghas not disabled validation, call thevalidatemethod of the specifiedActionForm, and forward to the input path if there were any errors. Returntrueif we should continue processing, orfalseif we have already forwarded control back to the input form.- Overrides:
processValidatein classRequestProcessor- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creatingform- The ActionForm instance we are populatingmapping- The ActionMapping we are using- Returns:
trueto continue normal processing;falseif a response has been created.- Throws:
IOException- if an input/output error occursServletException- if a servlet exception occursInvalidCancelException- if a cancellation is attempted without the proper action configuration.
-