org.apache.myfaces.application
Class ResourceHandlerImpl

java.lang.Object
  extended by javax.faces.application.ResourceHandler
      extended by org.apache.myfaces.application.ResourceHandlerImpl

public class ResourceHandlerImpl
extends ResourceHandler

DOCUMENT ME!

Version:
$Revision: 1533292 $ $Date: 2013-10-17 18:36:13 -0500 (Thu, 17 Oct 2013) $
Author:
Simon Lessard (latest modification by $Author: lu4242 $)

Field Summary
static String INIT_PARAM_RESOURCE_BUFFER_SIZE
          Define the default buffer size that is used between Resource.getInputStream() and httpServletResponse.getOutputStream() when rendering resources using the default ResourceHandler.
static int INIT_PARAM_RESOURCE_BUFFER_SIZE_DEFAULT
           
static String INIT_PARAM_STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME
          Allow slash in the library name of a Resource.
static boolean INIT_PARAM_STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME_DEFAULT
           
static Pattern LIBRARY_VERSION_CHECKER
           
static Pattern RESOURCE_VERSION_CHECKER
           
 
Fields inherited from class javax.faces.application.ResourceHandler
LOCALE_PREFIX, RESOURCE_CONTRACT_XML, RESOURCE_EXCLUDES_DEFAULT_VALUE, RESOURCE_EXCLUDES_PARAM_NAME, RESOURCE_IDENTIFIER, WEBAPP_CONTRACTS_DIRECTORY_PARAM_NAME, WEBAPP_RESOURCES_DIRECTORY_PARAM_NAME
 
Constructor Summary
ResourceHandlerImpl()
           
 
Method Summary
 Resource createResource(String resourceName)
           
 Resource createResource(String resourceName, String libraryName)
           
 Resource createResource(String resourceName, String libraryName, String contentType)
           
 Resource createResourceFromId(String resourceId)
           
 Resource createViewResource(FacesContext facesContext, String resourceName)
           
protected  ResourceMeta deriveResourceMeta(ContractResourceLoader resourceLoader, String resourceName, String libraryName, String localePrefix, String contractName)
           
protected  ResourceMeta deriveResourceMeta(FacesContext context, ContractResourceLoader resourceLoader, String resourceId, String contractName)
           
protected  ResourceMeta deriveResourceMeta(FacesContext context, ResourceLoader resourceLoader, String resourceId)
           
protected  ResourceMeta deriveResourceMeta(ResourceLoader resourceLoader, String resourceName, String libraryName, String localePrefix)
          This method try to create a ResourceMeta for a specific resource loader.
protected  ResourceMeta deriveViewResourceMeta(FacesContext context, ContractResourceLoader resourceLoader, String resourceName, String localePrefix, String contractName)
           
protected  ResourceMeta deriveViewResourceMeta(FacesContext context, ResourceLoader resourceLoader, String resourceName, String localePrefix)
           
protected  String getContractNameForLocateResource(FacesContext context)
           
protected  String getLocalePrefixForLocateResource()
           
protected  String getLocalePrefixForLocateResource(FacesContext context)
           
 String getRendererTypeForResourceName(String resourceName)
           
protected  int getResourceBufferSize()
           
protected  ResourceHandlerSupport getResourceHandlerSupport()
           
 void handleResourceRequest(FacesContext facesContext)
          Handle the resource request, writing in the output.
protected  boolean isAllowSlashesLibraryName()
           
protected  boolean isResourceIdentifierExcluded(FacesContext context, String resourceIdentifier)
           
 boolean isResourceRequest(FacesContext facesContext)
           
 boolean libraryExists(String libraryName)
          Check if a library exists or not.
 void setResourceHandlerSupport(ResourceHandlerSupport resourceHandlerSupport)
           
 
Methods inherited from class javax.faces.application.ResourceHandler
isResourceURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_PARAM_STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME

@JSFWebConfigParam(since="2.1.6, 2.0.12",
                   defaultValue="false",
                   expectedValues="true, false",
                   group="resources")
public static final String INIT_PARAM_STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME
Allow slash in the library name of a Resource.

See Also:
Constant Field Values

INIT_PARAM_STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME_DEFAULT

public static final boolean INIT_PARAM_STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME_DEFAULT
See Also:
Constant Field Values

INIT_PARAM_RESOURCE_BUFFER_SIZE

@JSFWebConfigParam(since="2.1.10, 2.0.16",
                   defaultValue="2048",
                   group="resources")
public static final String INIT_PARAM_RESOURCE_BUFFER_SIZE
Define the default buffer size that is used between Resource.getInputStream() and httpServletResponse.getOutputStream() when rendering resources using the default ResourceHandler.

See Also:
Constant Field Values

INIT_PARAM_RESOURCE_BUFFER_SIZE_DEFAULT

public static final int INIT_PARAM_RESOURCE_BUFFER_SIZE_DEFAULT
See Also:
Constant Field Values

LIBRARY_VERSION_CHECKER

public static final Pattern LIBRARY_VERSION_CHECKER

RESOURCE_VERSION_CHECKER

public static final Pattern RESOURCE_VERSION_CHECKER
Constructor Detail

ResourceHandlerImpl

public ResourceHandlerImpl()
Method Detail

createResource

public Resource createResource(String resourceName)
Specified by:
createResource in class ResourceHandler

createResource

public Resource createResource(String resourceName,
                               String libraryName)
Specified by:
createResource in class ResourceHandler

createResource

public Resource createResource(String resourceName,
                               String libraryName,
                               String contentType)
Specified by:
createResource in class ResourceHandler

deriveResourceMeta

protected ResourceMeta deriveResourceMeta(ContractResourceLoader resourceLoader,
                                          String resourceName,
                                          String libraryName,
                                          String localePrefix,
                                          String contractName)

deriveResourceMeta

protected ResourceMeta deriveResourceMeta(ResourceLoader resourceLoader,
                                          String resourceName,
                                          String libraryName,
                                          String localePrefix)
This method try to create a ResourceMeta for a specific resource loader. If no library, or resource is found, just return null, so the algorithm in createResource can continue checking with the next registered ResourceLoader.


getRendererTypeForResourceName

public String getRendererTypeForResourceName(String resourceName)
Specified by:
getRendererTypeForResourceName in class ResourceHandler

handleResourceRequest

public void handleResourceRequest(FacesContext facesContext)
                           throws IOException
Handle the resource request, writing in the output. This method implements an algorithm semantically identical to the one described on the javadoc of ResourceHandler.handleResourceRequest

Specified by:
handleResourceRequest in class ResourceHandler
Throws:
IOException

isResourceRequest

public boolean isResourceRequest(FacesContext facesContext)
Specified by:
isResourceRequest in class ResourceHandler

getLocalePrefixForLocateResource

protected String getLocalePrefixForLocateResource()

getLocalePrefixForLocateResource

protected String getLocalePrefixForLocateResource(FacesContext context)

getContractNameForLocateResource

protected String getContractNameForLocateResource(FacesContext context)

isResourceIdentifierExcluded

protected boolean isResourceIdentifierExcluded(FacesContext context,
                                               String resourceIdentifier)

libraryExists

public boolean libraryExists(String libraryName)
Check if a library exists or not. This is done delegating to each ResourceLoader used, because each one has a different prefix and way to load resources.

Specified by:
libraryExists in class ResourceHandler

setResourceHandlerSupport

public void setResourceHandlerSupport(ResourceHandlerSupport resourceHandlerSupport)
Parameters:
resourceHandlerSupport - the resourceHandlerSupport to set

getResourceHandlerSupport

protected ResourceHandlerSupport getResourceHandlerSupport()
Returns:
the resourceHandlerSupport

isAllowSlashesLibraryName

protected boolean isAllowSlashesLibraryName()

getResourceBufferSize

protected int getResourceBufferSize()

createResourceFromId

public Resource createResourceFromId(String resourceId)
Overrides:
createResourceFromId in class ResourceHandler

deriveResourceMeta

protected ResourceMeta deriveResourceMeta(FacesContext context,
                                          ResourceLoader resourceLoader,
                                          String resourceId)

deriveResourceMeta

protected ResourceMeta deriveResourceMeta(FacesContext context,
                                          ContractResourceLoader resourceLoader,
                                          String resourceId,
                                          String contractName)

deriveViewResourceMeta

protected ResourceMeta deriveViewResourceMeta(FacesContext context,
                                              ResourceLoader resourceLoader,
                                              String resourceName,
                                              String localePrefix)

deriveViewResourceMeta

protected ResourceMeta deriveViewResourceMeta(FacesContext context,
                                              ContractResourceLoader resourceLoader,
                                              String resourceName,
                                              String localePrefix,
                                              String contractName)

createViewResource

public Resource createViewResource(FacesContext facesContext,
                                   String resourceName)
Overrides:
createViewResource in class ResourceHandler


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