org.apache.myfaces.commons.resourcehandler.resource
Class BaseResourceHandlerSupport

java.lang.Object
  extended by org.apache.myfaces.commons.resourcehandler.resource.ResourceHandlerSupport
      extended by org.apache.myfaces.commons.resourcehandler.resource.BaseResourceHandlerSupport
Direct Known Subclasses:
ExtendedDefaultResourceHandlerSupport

public class BaseResourceHandlerSupport
extends 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: 946779 $ $Date: 2010-05-20 15:31:42 -0500 (Jue, 20 May 2010) $
Author:
Leonardo Uribe (latest modification by $Author: lu4242 $)

Field Summary
static String RESOURCE_MAX_TIME_EXPIRES
          Set the max time in miliseconds set on the "Expires" header for a resource.
 
Constructor Summary
BaseResourceHandlerSupport()
           
 
Method Summary
protected static FacesServletMapping calculateFacesServletMapping(String servletPath, String pathInfo)
          Determines the mapping of the FacesServlet in the web.xml configuration file.
 String calculateResourceBasePath(javax.faces.context.FacesContext facesContext)
          Calculate the resource base path.
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.
 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 org.apache.myfaces.commons.resourcehandler.resource.ResourceHandlerSupport
getResourceIdentifier
 
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 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

BaseResourceHandlerSupport

public BaseResourceHandlerSupport()
Method Detail

getResourceLoaders

public ResourceLoader[] getResourceLoaders()
Description copied from class: 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 class ResourceHandlerSupport
Returns:

calculateResourceBasePath

public String calculateResourceBasePath(javax.faces.context.FacesContext facesContext)
Description copied from class: 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 class ResourceHandlerSupport

isExtensionMapping

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

Specified by:
isExtensionMapping in class ResourceHandlerSupport
Returns:

getMapping

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

Specified by:
getMapping in class ResourceHandlerSupport
Returns:

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(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

getStartupTime

public long getStartupTime()
Description copied from class: 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 class ResourceHandlerSupport
Returns:

getMaxTimeExpires

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

Specified by:
getMaxTimeExpires in class ResourceHandlerSupport
Returns:


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