public class ClasspathResourceHelper extends ResourceHelper
A ResourceHelper
implementation for finding/serving resources
found on the classpath within the META-INF/resources directory.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
BASE_RESOURCE_PATH |
private boolean |
cacheTimestamp |
private boolean |
enableMissingResourceLibraryDetection |
private ZipDirectoryEntryScanner |
libraryScanner |
Constructor and Description |
---|
ClasspathResourceHelper() |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
deriveBasePath(LibraryInfo library,
java.lang.String resourceName,
java.lang.String localePrefix) |
boolean |
equals(java.lang.Object obj) |
LibraryInfo |
findLibrary(java.lang.String libraryName,
java.lang.String localePrefix,
java.lang.String contract,
javax.faces.context.FacesContext ctx)
Search for the specified library/localPrefix combination in an
implementation dependent manner.
|
LibraryInfo |
findLibraryWithZipDirectoryEntryScan(java.lang.String libraryName,
java.lang.String localePrefix,
java.lang.String contract,
javax.faces.context.FacesContext ctx,
boolean forceScan) |
private java.net.URL |
findPathConsideringContracts(java.lang.ClassLoader loader,
LibraryInfo library,
java.lang.String resourceName,
java.lang.String localePrefix,
ContractInfo[] outContract,
java.lang.String[] outBasePath,
javax.faces.context.FacesContext ctx) |
ResourceInfo |
findResource(LibraryInfo library,
java.lang.String resourceName,
java.lang.String localePrefix,
boolean compressable,
javax.faces.context.FacesContext ctx)
Search for the specified resource based in the library/localePrefix/resourceName
combination in an implementation dependent manner.
|
java.lang.String |
getBaseContractsPath() |
java.lang.String |
getBaseResourcePath() |
protected java.io.InputStream |
getNonCompressedInputStream(ResourceInfo resource,
javax.faces.context.FacesContext ctx)
If a
ResourceInfo is not compressable, ResourceHelper.getInputStream(ResourceInfo, javax.faces.context.FacesContext)
will call this method to return a stream to the actual resource. |
java.net.URL |
getURL(ResourceInfo resource,
javax.faces.context.FacesContext ctx) |
int |
hashCode() |
clientAcceptsCompression, compressContent, getBasePath, getInputStream, getLastModified, getVersion, handleCompression, resourceSupportsEL, trimLeadingSlash
private static final java.lang.String BASE_RESOURCE_PATH
private boolean cacheTimestamp
private volatile ZipDirectoryEntryScanner libraryScanner
private boolean enableMissingResourceLibraryDetection
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getBaseResourcePath()
getBaseResourcePath
in class ResourceHelper
ResourceHelper.getBaseResourcePath()
public java.lang.String getBaseContractsPath()
getBaseContractsPath
in class ResourceHelper
protected java.io.InputStream getNonCompressedInputStream(ResourceInfo resource, javax.faces.context.FacesContext ctx) throws java.io.IOException
ResourceHelper
ResourceInfo
is not compressable, ResourceHelper.getInputStream(ResourceInfo, javax.faces.context.FacesContext)
will call this method to return a stream to the actual resource.getNonCompressedInputStream
in class ResourceHelper
resource
- the resource to obtain an InputStream toctx
- the FacesContext
for the current requestjava.io.IOException
- if an error occurs obtaining the streamResourceHelper.getNonCompressedInputStream(com.sun.faces.application.resource.ResourceInfo, javax.faces.context.FacesContext)
public java.net.URL getURL(ResourceInfo resource, javax.faces.context.FacesContext ctx)
getURL
in class ResourceHelper
resource
- the resource to obtain a URL reference toctx
- the FacesContext
for the current requestnull
if no resource is foundResourceHelper.getURL(com.sun.faces.application.resource.ResourceInfo, javax.faces.context.FacesContext)
public LibraryInfo findLibrary(java.lang.String libraryName, java.lang.String localePrefix, java.lang.String contract, javax.faces.context.FacesContext ctx)
ResourceHelper
findLibrary
in class ResourceHelper
libraryName
- the name of the librarylocalePrefix
- the logicial identifier for a locale specific library.
if no localePrefix is configured, pass null
contract
- the name of the contractctx
- the FacesContext
for the current request @return a LibraryInfo
if a matching library based off the inputs
can be found, otherwise returns null
ResourceHelper.findLibrary(String, String, String, javax.faces.context.FacesContext)
public LibraryInfo findLibraryWithZipDirectoryEntryScan(java.lang.String libraryName, java.lang.String localePrefix, java.lang.String contract, javax.faces.context.FacesContext ctx, boolean forceScan)
public ResourceInfo findResource(LibraryInfo library, java.lang.String resourceName, java.lang.String localePrefix, boolean compressable, javax.faces.context.FacesContext ctx)
ResourceHelper
Search for the specified resource based in the library/localePrefix/resourceName combination in an implementation dependent manner.
If the resource is found, and is compressable, call ResourceHelper.handleCompression(com.sun.faces.application.resource.ClientResourceInfo)
to compress the content.
findResource
in class ResourceHelper
library
- the library this resource should be a part of. If the
the resource that is being searched for isn't part of a library, then
pass null
resourceName
- the name of the resource that is being searched forlocalePrefix
- the logicial identifier for a locale specific library.
if no localePrefix is configured, pass null
compressable
- true
if the resource can be compressedctx
- the FacesContext
for the current requestResourceInfo
if a matching resource based off the inputs
can be found, otherwise returns null
ResourceHelper.findResource(LibraryInfo, String, String, boolean, javax.faces.context.FacesContext)
private java.lang.String deriveBasePath(LibraryInfo library, java.lang.String resourceName, java.lang.String localePrefix)
private java.net.URL findPathConsideringContracts(java.lang.ClassLoader loader, LibraryInfo library, java.lang.String resourceName, java.lang.String localePrefix, ContractInfo[] outContract, java.lang.String[] outBasePath, javax.faces.context.FacesContext ctx)
Copyright © 2002-2013 Oracle America, Inc. All Rights Reserved.