org.apache.myfaces.application
Class DefaultResourceHandlerSupport

java.lang.Object
  extended by org.apache.myfaces.application.DefaultResourceHandlerSupport
All Implemented Interfaces:
ResourceHandlerSupport

public class DefaultResourceHandlerSupport
extends java.lang.Object
implements ResourceHandlerSupport

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

Version:
$Revision: 915763 $ $Date: 2010-02-24 07:24:11 -0500 (Wed, 24 Feb 2010) $
Author:
Leonardo Uribe (latest modification by $Author: bommel $)

Field Summary
static java.lang.String RESOURCE_MAX_TIME_EXPIRES
          Set the max time in miliseconds set on the "Expires" header for a resource.
 
Constructor Summary
DefaultResourceHandlerSupport()
           
 
Method Summary
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 calculateResourceBasePath(FacesContext facesContext)
          Calculate the resource base path.
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.
 java.lang.String getMapping()
          Get the mapping used as prefix(/faces) or sufix(.jsf)
 long getMaxTimeExpires()
          Return the time that should be set on "Expires" header in a resource.
 ResourceLoader[] getResourceLoaders()
          Return an array of resource loaders used to find resources using the standard.
 long getStartupTime()
          Return the time when the app started.
 boolean isExtensionMapping()
          Check if the mapping used is done using extensions (.xhtml, .jsf) or if it is not (/faces/*)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_MAX_TIME_EXPIRES

@JSFWebConfigParam(since="2.0",
                   defaultValue="604800000")
public static final java.lang.String RESOURCE_MAX_TIME_EXPIRES
Set the max time in miliseconds set on the "Expires" header for a resource. (default to one week in miliseconds or 604800000)

See Also:
Constant Field Values
Constructor Detail

DefaultResourceHandlerSupport

public DefaultResourceHandlerSupport()
Method Detail

calculateResourceBasePath

public java.lang.String calculateResourceBasePath(FacesContext facesContext)
Description copied from interface: ResourceHandlerSupport
Calculate the resource base path. It should extract a string like: ResourceHandler.RESOURCE_IDENTIFIER + '/' + getResourceName() For example: /javax.faces.resource/image.jpg This is used on ResourceHandler.handleResourceRequest()

Specified by:
calculateResourceBasePath in interface ResourceHandlerSupport

getResourceLoaders

public ResourceLoader[] getResourceLoaders()
Description copied from interface: ResourceHandlerSupport
Return an array of resource loaders used to find resources using the standard. The order of ResourceLoaders define its precedence.

Specified by:
getResourceLoaders in interface ResourceHandlerSupport
Returns:

isExtensionMapping

public boolean isExtensionMapping()
Description copied from interface: ResourceHandlerSupport
Check if the mapping used is done using extensions (.xhtml, .jsf) or if it is not (/faces/*)

Specified by:
isExtensionMapping in interface ResourceHandlerSupport
Returns:

getMapping

public java.lang.String getMapping()
Description copied from interface: ResourceHandlerSupport
Get the mapping used as prefix(/faces) or sufix(.jsf)

Specified by:
getMapping in interface ResourceHandlerSupport
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(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

getStartupTime

public long getStartupTime()
Description copied from interface: ResourceHandlerSupport
Return the time when the app started. This is useful to set the "Last-Modified" header in some specific cases.

Specified by:
getStartupTime in interface ResourceHandlerSupport
Returns:

getMaxTimeExpires

public long getMaxTimeExpires()
Description copied from interface: ResourceHandlerSupport
Return the time that should be set on "Expires" header in a resource.

Specified by:
getMaxTimeExpires in interface ResourceHandlerSupport
Returns:


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