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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanfindLibrary(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 InputStreamgetNonCompressedInputStream(ResourceInfo resource, FacesContext ctx) If aResourceInfois 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) inthashCode()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:
getBaseResourcePathin classResourceHelper- Returns:
- the base path in which resources will be stored
- See Also:
-
getBaseContractsPath
- Specified by:
getBaseContractsPathin classResourceHelper
-
getNonCompressedInputStream
protected InputStream getNonCompressedInputStream(ResourceInfo resource, FacesContext ctx) throws IOException Description copied from class:ResourceHelperIf aResourceInfois not compressable,ResourceHelper.getInputStream(ResourceInfo, jakarta.faces.context.FacesContext)will call this method to return a stream to the actual resource.- Specified by:
getNonCompressedInputStreamin classResourceHelper- Parameters:
resource- the resource to obtain an InputStream toctx- theFacesContextfor the current request- Returns:
- an InputStream to the resource
- Throws:
IOException- if an error occurs obtaining the stream- See Also:
-
getURL
- Specified by:
getURLin classResourceHelper- Parameters:
resource- the resource to obtain a URL reference toctx- theFacesContextfor the current request- Returns:
- a URL to the specified resource, otherwise
nullif no resource is found - See Also:
-
findLibrary
public LibraryInfo findLibrary(String libraryName, String localePrefix, String contract, FacesContext ctx) Description copied from class:ResourceHelperSearch for the specified library/localPrefix combination in an implementation dependent manner.- Specified by:
findLibraryin classResourceHelper- Parameters:
libraryName- the name of the librarylocalePrefix- the logicial identifier for a locale specific library. if no localePrefix is configured, passnullcontract- the name of the contractctx- theFacesContextfor the current request @return aLibraryInfoif 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:ResourceHelperSearch 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:
findResourcein 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 passnullresourceName- the name of the resource that is being searched forlocalePrefix- the logicial identifier for a locale specific library. if no localePrefix is configured, passnullcompressable-trueif the resource can be compressedctx- theFacesContextfor the current request- Returns:
- a
ResourceInfoif a matching resource based off the inputs can be found, otherwise returnsnull - See Also:
-