org.apache.myfaces.shared.resource
Class BaseResourceHandlerSupport

java.lang.Object
  extended by org.apache.myfaces.shared.resource.ResourceHandlerSupport
      extended by org.apache.myfaces.shared.resource.BaseResourceHandlerSupport

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: 1200042 $ $Date: 2011-11-09 18:40:12 -0500 (Wed, 09 Nov 2011) $
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 rendered by the default ResourceHandler.
 
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(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.
 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.shared.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",
                   group="resources",
                   tags="performance")
public static final String RESOURCE_MAX_TIME_EXPIRES
Set the max time in miliseconds set on the "Expires" header for a resource rendered by the default ResourceHandler. (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(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(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 © 2014 The Apache Software Foundation. All Rights Reserved.