java.lang.Object
com.sun.faces.application.resource.ResourceHelper
com.sun.faces.application.resource.WebappResourceHelper
A ResourceHelper
implementation for finding/serving resources found within
<contextroot>/resources
directory of a web application.
- Since:
- 2.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
findLibrary
(String libraryName, String localePrefix, String contract, FacesContext ctx) Search for the specified library/localPrefix combination in an implementation dependent manner.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.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.getURL
(ResourceInfo resource, FacesContext ctx) int
hashCode()
Methods inherited from class com.sun.faces.application.resource.ResourceHelper
clientAcceptsCompression, compressContent, getBasePath, getInputStream, getLastModified, getLocalizedPaths, getVersion, handleCompression, resourceSupportsEL, trimLeadingSlash
-
Constructor Details
-
WebappResourceHelper
public WebappResourceHelper()
-
-
Method Details
-
equals
-
hashCode
-
getBaseResourcePath
- Specified by:
getBaseResourcePath
in classResourceHelper
- Returns:
- the base path in which resources will be stored
- See Also:
-
getBaseContractsPath
- Specified by:
getBaseContractsPath
in classResourceHelper
-
getNonCompressedInputStream
protected InputStream getNonCompressedInputStream(ResourceInfo resource, FacesContext ctx) throws IOException Description 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:
-
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:
-
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
- Returns:
- library info
- See Also:
-
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:
-