Class ClasspathResourceHelper
java.lang.Object
com.sun.faces.application.resource.ResourceHelper
com.sun.faces.application.resource.ClasspathResourceHelper
public class ClasspathResourceHelper extends ResourceHelper
A ResourceHelper
implementation for finding/serving resources found on the classpath within the
META-INF/resources directory.
- Since:
- 2.0
-
Constructor Summary
Constructors Constructor Description ClasspathResourceHelper()
-
Method Summary
Modifier and Type Method Description boolean
equals(Object obj)
LibraryInfo
findLibrary(String libraryName, String localePrefix, String contract, FacesContext ctx)
Search for the specified library/localPrefix combination in an implementation dependent manner.LibraryInfo
findLibraryWithZipDirectoryEntryScan(String libraryName, String localePrefix, String contract, FacesContext ctx, boolean forceScan)
ResourceInfo
findResource(LibraryInfo library, String resourceName, String localePrefix, boolean compressable, FacesContext ctx)
Search for the specified resource based in the library/localePrefix/resourceName combination in an implementation dependent manner.String
getBaseContractsPath()
String
getBaseResourcePath()
protected InputStream
getNonCompressedInputStream(ResourceInfo resource, FacesContext ctx)
If aResourceInfo
is not compressable,ResourceHelper.getInputStream(ResourceInfo, jakarta.faces.context.FacesContext)
will call this method to return a stream to the actual resource.URL
getURL(ResourceInfo resource, FacesContext ctx)
int
hashCode()
Methods inherited from class com.sun.faces.application.resource.ResourceHelper
clientAcceptsCompression, compressContent, getBasePath, getInputStream, getLastModified, getVersion, handleCompression, resourceSupportsEL, trimLeadingSlash
-
Constructor Details
-
ClasspathResourceHelper
public ClasspathResourceHelper()
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
getBaseResourcePath
- Specified by:
getBaseResourcePath
in classResourceHelper
- Returns:
- the base path in which resources will be stored
- See Also:
ResourceHelper.getBaseResourcePath()
-
getBaseContractsPath
- Specified by:
getBaseContractsPath
in classResourceHelper
-
getNonCompressedInputStream
protected InputStream getNonCompressedInputStream(ResourceInfo resource, FacesContext ctx) throws IOExceptionDescription copied from class:ResourceHelper
If aResourceInfo
is not compressable,ResourceHelper.getInputStream(ResourceInfo, jakarta.faces.context.FacesContext)
will call this method to return a stream to the actual resource.- Specified by:
getNonCompressedInputStream
in classResourceHelper
- Parameters:
resource
- the resource to obtain an InputStream toctx
- theFacesContext
for the current request- Returns:
- an InputStream to the resource
- Throws:
IOException
- if an error occurs obtaining the stream- See Also:
ResourceHelper.getNonCompressedInputStream(com.sun.faces.application.resource.ResourceInfo, jakarta.faces.context.FacesContext)
-
getURL
- Specified by:
getURL
in classResourceHelper
- Parameters:
resource
- the resource to obtain a URL reference toctx
- theFacesContext
for the current request- Returns:
- a URL to the specified resource, otherwise
null
if no resource is found - See Also:
ResourceHelper.getURL(com.sun.faces.application.resource.ResourceInfo, jakarta.faces.context.FacesContext)
-
findLibrary
public LibraryInfo findLibrary(String libraryName, String localePrefix, String contract, FacesContext ctx)Description copied from class:ResourceHelper
Search for the specified library/localPrefix combination in an implementation dependent manner.- Specified by:
findLibrary
in classResourceHelper
- Parameters:
libraryName
- the name of the librarylocalePrefix
- the logicial identifier for a locale specific library. if no localePrefix is configured, passnull
contract
- the name of the contractctx
- theFacesContext
for the current request @return aLibraryInfo
if a matching library based off the inputs can be found, otherwise returnsnull
- See Also:
ResourceHelper.findLibrary(String, String, String, jakarta.faces.context.FacesContext)
-
findLibraryWithZipDirectoryEntryScan
public LibraryInfo findLibraryWithZipDirectoryEntryScan(String libraryName, String localePrefix, String contract, FacesContext ctx, boolean forceScan) -
findResource
public ResourceInfo findResource(LibraryInfo library, String resourceName, String localePrefix, boolean compressable, FacesContext ctx)Description copied from class: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.- Specified by:
findResource
in classResourceHelper
- Parameters:
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 passnull
resourceName
- the name of the resource that is being searched forlocalePrefix
- the logicial identifier for a locale specific library. if no localePrefix is configured, passnull
compressable
-true
if the resource can be compressedctx
- theFacesContext
for the current request- Returns:
- a
ResourceInfo
if a matching resource based off the inputs can be found, otherwise returnsnull
- See Also:
ResourceHelper.findResource(LibraryInfo, String, String, boolean, jakarta.faces.context.FacesContext)
-