Class WebappResourceHelper
java.lang.Object
com.sun.faces.application.resource.ResourceHelper
com.sun.faces.application.resource.WebappResourceHelper
public class WebappResourceHelper extends ResourceHelper
A ResourceHelper
implementation for finding/serving resources found within
<contextroot>/resources
directory of a web application.
- Since:
- 2.0
-
Constructor Summary
Constructors Constructor Description WebappResourceHelper()
-
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.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
-
WebappResourceHelper
public WebappResourceHelper()
-
-
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)
-
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)
-