org.apache.myfaces.shared.application
Class DefaultViewHandlerSupport

java.lang.Object
  extended by org.apache.myfaces.shared.application.DefaultViewHandlerSupport
All Implemented Interfaces:
ViewHandlerSupport

public class DefaultViewHandlerSupport
extends java.lang.Object
implements ViewHandlerSupport

A ViewHandlerSupport implementation for use with standard Java Servlet engines, ie an engine that supports javax.servlet, and uses a standard web.xml file.

Version:
$Revision: 887436 $ $Date: 2009-12-04 16:11:25 -0700 (Fri, 04 Dec 2009) $
Author:
Mathias Broekelmann (latest modification by $Author: lu4242 $)

Constructor Summary
DefaultViewHandlerSupport()
           
 
Method Summary
 java.lang.String calculateActionURL(javax.faces.context.FacesContext context, java.lang.String viewId)
          Return a string containing a webapp-relative URL that the user can invoke to render the specified view.
 java.lang.String calculateAndCheckViewId(javax.faces.context.FacesContext context, java.lang.String viewId)
           
protected static FacesServletMapping calculateFacesServletMapping(java.lang.String servletPath, java.lang.String pathInfo)
          Determines the mapping of the FacesServlet in the web.xml configuration file.
 java.lang.String calculateViewId(javax.faces.context.FacesContext context, java.lang.String viewId)
           
protected  boolean checkResourceExists(javax.faces.context.FacesContext context, java.lang.String viewId)
           
protected  java.lang.String[] getContextSuffix(javax.faces.context.FacesContext context)
           
protected  java.lang.String getFaceletsContextSuffix(javax.faces.context.FacesContext context)
           
protected  java.lang.String[] getFaceletsViewMappings(javax.faces.context.FacesContext context)
           
protected  FacesServletMapping getFacesServletMapping(javax.faces.context.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  java.lang.String handlePrefixMapping(java.lang.String viewId, java.lang.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  java.lang.String handleSuffixMapping(javax.faces.context.FacesContext context, java.lang.String requestViewId)
          Return the viewId with any non-standard suffix stripped off and replaced with the default suffix configured for the specified context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultViewHandlerSupport

public DefaultViewHandlerSupport()
Method Detail

calculateViewId

public java.lang.String calculateViewId(javax.faces.context.FacesContext context,
                                        java.lang.String viewId)
Specified by:
calculateViewId in interface ViewHandlerSupport

calculateAndCheckViewId

public java.lang.String calculateAndCheckViewId(javax.faces.context.FacesContext context,
                                                java.lang.String viewId)
Specified by:
calculateAndCheckViewId in interface ViewHandlerSupport

calculateActionURL

public java.lang.String calculateActionURL(javax.faces.context.FacesContext context,
                                           java.lang.String viewId)
Description copied from interface: ViewHandlerSupport
Return a string containing a webapp-relative URL that the user can invoke to render the specified view.

URLs and ViewIds are not quite the same; for example a url of "/foo.jsf" or "/faces/foo.jsp" may be needed to access the view "/foo.jsp".

Specified by:
calculateActionURL in interface ViewHandlerSupport

getFacesServletMapping

protected FacesServletMapping getFacesServletMapping(javax.faces.context.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(java.lang.String servletPath,
                                                                  java.lang.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

getContextSuffix

protected java.lang.String[] getContextSuffix(javax.faces.context.FacesContext context)

getFaceletsContextSuffix

protected java.lang.String getFaceletsContextSuffix(javax.faces.context.FacesContext context)

getFaceletsViewMappings

protected java.lang.String[] getFaceletsViewMappings(javax.faces.context.FacesContext context)

handlePrefixMapping

protected java.lang.String handlePrefixMapping(java.lang.String viewId,
                                               java.lang.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 java.lang.String handleSuffixMapping(javax.faces.context.FacesContext context,
                                               java.lang.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(javax.faces.context.FacesContext context,
                                      java.lang.String viewId)


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