org.apache.myfaces.application
Class DefaultViewHandlerSupport

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

public class DefaultViewHandlerSupport
extends 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: 673811 $ $Date: 2008-07-03 16:18:36 -0500 (Thu, 03 Jul 2008) $
Author:
Mathias Broekelmann (latest modification by $Author: skitching $)

Nested Class Summary
protected static class DefaultViewHandlerSupport.FacesServletMapping
          Represents a mapping entry of the FacesServlet in the web.xml configuration file.
 
Constructor Summary
DefaultViewHandlerSupport()
           
 
Method Summary
protected  String applyDefaultSuffix(FacesContext context, String viewId)
          Return the viewId with any non-standard suffix stripped off and replaced with the default suffix configured for the specified context.
 String calculateActionURL(FacesContext context, String viewId)
          Return a string containing a webapp-relative URL that the user can invoke to render the specified view.
protected static DefaultViewHandlerSupport.FacesServletMapping calculateFacesServletMapping(String servletPath, String pathInfo)
          Determines the mapping of the FacesServlet in the web.xml configuration file.
 String calculateViewId(FacesContext context, String viewId)
           
protected  String getContextSuffix(FacesContext context)
           
protected  DefaultViewHandlerSupport.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.
 
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 String calculateViewId(FacesContext context,
                              String viewId)
Specified by:
calculateViewId in interface ViewHandlerSupport

calculateActionURL

public String calculateActionURL(FacesContext context,
                                 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 DefaultViewHandlerSupport.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 DefaultViewHandlerSupport.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

getContextSuffix

protected String getContextSuffix(FacesContext context)

applyDefaultSuffix

protected String applyDefaultSuffix(FacesContext context,
                                    String viewId)
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".



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