org.apache.myfaces.lifecycle
Class DefaultRestoreViewSupport

java.lang.Object
  extended by org.apache.myfaces.lifecycle.DefaultRestoreViewSupport
All Implemented Interfaces:
RestoreViewSupport

public class DefaultRestoreViewSupport
extends Object
implements RestoreViewSupport

Version:
$Revision: 1533114 $ $Date: 2013-10-17 10:25:52 -0500 (Thu, 17 Oct 2013) $
Author:
Mathias Broekelmann (latest modification by $Author: lu4242 $)

Constructor Summary
DefaultRestoreViewSupport()
           
DefaultRestoreViewSupport(FacesContext facesContext)
           
 
Method Summary
protected static FacesServletMapping calculateFacesServletMapping(String servletPath, String pathInfo)
          Determines the mapping of the FacesServlet in the web.xml configuration file.
 String calculateViewId(FacesContext facesContext)
           Calculates the view id from the given faces context by the following algorithm
protected  boolean checkResourceExists(FacesContext context, String viewId)
           
 boolean checkViewExists(FacesContext facesContext, String viewId)
          Check if a view exists
 String deriveViewId(FacesContext context, String viewId)
          Deprecated. 
protected  String[] getContextSuffix(FacesContext context)
           
protected  String getFaceletsContextSuffix(FacesContext context)
           
protected  String[] getFaceletsViewMappings(FacesContext context)
           
protected  FacesServletMapping getFacesServletMapping(FacesContext context)
          Read the web.xml file that is in the classpath and parse its internals to figure out how the FacesServlet is mapped for the current webapp.
protected  RenderKitFactory getRenderKitFactory()
           
protected  VisitContextFactory getVisitContextFactory()
           
protected  String handlePrefixMapping(String viewId, String prefix)
          Return the normalized viewId according to the algorithm specified in 7.5.2 by stripping off any number of occurrences of the prefix mapping from the viewId.
protected  String handleSuffixMapping(FacesContext context, String requestViewId)
          Return the viewId with any non-standard suffix stripped off and replaced with the default suffix configured for the specified context.
 boolean isPostback(FacesContext facesContext)
           Determine if the current request is a post back by the following algorithm.
 void processComponentBinding(FacesContext facesContext, UIComponent component)
          Processes the component tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRestoreViewSupport

public DefaultRestoreViewSupport()

DefaultRestoreViewSupport

public DefaultRestoreViewSupport(FacesContext facesContext)
Method Detail

processComponentBinding

public void processComponentBinding(FacesContext facesContext,
                                    UIComponent component)
Description copied from interface: RestoreViewSupport
Processes the component tree. For each component (including the given one) in the tree determine if a value expression for the attribute "binding" is defined. If the expression is not null set the component instance to the value of this expression

Specified by:
processComponentBinding in interface RestoreViewSupport
component - the root component

calculateViewId

public String calculateViewId(FacesContext facesContext)
Description copied from interface: RestoreViewSupport

Calculates the view id from the given faces context by the following algorithm

Specified by:
calculateViewId in interface RestoreViewSupport

isPostback

public boolean isPostback(FacesContext facesContext)
Description copied from interface: RestoreViewSupport

Determine if the current request is a post back by the following algorithm.

Find the render-kit-id for the current request by calling calculateRenderKitId() on the Application’s ViewHandler. Get that RenderKit’s ResponseStateManager and call its isPostback() method, passing the given FacesContext.

Specified by:
isPostback in interface RestoreViewSupport
Returns:

getRenderKitFactory

protected RenderKitFactory getRenderKitFactory()

getVisitContextFactory

protected VisitContextFactory getVisitContextFactory()

deriveViewId

@Deprecated
public String deriveViewId(FacesContext context,
                                      String viewId)
Deprecated. 

Description copied from interface: RestoreViewSupport
Derive a view id retrieved from calling calculateViewId(FacesContext), but do not check if a resource with this name exists. This method is useful to retrieve a VDL instance, but note there are some cases (TCK test) where it is expected in Restore View algorithm a null or dummy viewId is passed.

Specified by:
deriveViewId in interface RestoreViewSupport
Returns:

getContextSuffix

protected String[] getContextSuffix(FacesContext context)

getFaceletsContextSuffix

protected String getFaceletsContextSuffix(FacesContext context)

getFaceletsViewMappings

protected String[] getFaceletsViewMappings(FacesContext context)

handlePrefixMapping

protected String handlePrefixMapping(String viewId,
                                     String prefix)
Return the normalized viewId according to the algorithm specified in 7.5.2 by stripping off any number of occurrences of the prefix mapping from the viewId.

For example, both /faces/view.xhtml and /faces/faces/faces/view.xhtml would both return view.xhtml F


handleSuffixMapping

protected String handleSuffixMapping(FacesContext context,
                                     String requestViewId)
Return the viewId with any non-standard suffix stripped off and replaced with the default suffix configured for the specified context.

For example, an input parameter of "/foo.jsf" may return "/foo.jsp".


checkResourceExists

protected boolean checkResourceExists(FacesContext context,
                                      String viewId)

checkViewExists

public boolean checkViewExists(FacesContext facesContext,
                               String viewId)
Description copied from interface: RestoreViewSupport
Check if a view exists

Specified by:
checkViewExists in interface RestoreViewSupport
Returns:

getFacesServletMapping

protected FacesServletMapping getFacesServletMapping(FacesContext context)
Read the web.xml file that is in the classpath and parse its internals to figure out how the FacesServlet is mapped for the current webapp.


calculateFacesServletMapping

protected static FacesServletMapping calculateFacesServletMapping(String servletPath,
                                                                  String pathInfo)
Determines the mapping of the FacesServlet in the web.xml configuration file. However, there is no need to actually parse this configuration file as runtime information is sufficient.

Parameters:
servletPath - The servletPath of the current request
pathInfo - The pathInfo of the current request
Returns:
the mapping of the FacesServlet in the web.xml configuration file


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.