Class ResourceWrapper
- All Implemented Interfaces:
FacesWrapper<Resource>
Provides
a simple implementation of
Resource that can be subclassed by developers wishing to
provide specialized behavior to an existing Resource
instance. The default implementation of all methods is to call
through to the wrapped Resource.
Usage: extend
this class and override getWrapped() to return the instance we
are wrapping.
- Since:
- 2.0
-
Field Summary
Fields inherited from class javax.faces.application.Resource
COMPONENT_RESOURCE_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe default behavior of this method is to callResource.getContentType()on the wrappedResourceHandlerobject.The default behavior of this method is to callResource.getInputStream()on the wrappedResourceHandlerobject.The default behavior of this method is to callResource.getLibraryName()on the wrappedResourceHandlerobject.The default behavior of this method is to callResource.getRequestPath()on the wrappedResourceHandlerobject.The default behavior of this method is to callResource.getResourceName()on the wrappedResourceHandlerobject.The default behavior of this method is to callResource.getResponseHeaders()on the wrappedResourceHandlerobject.getURL()The default behavior of this method is to callResource.getURL()on the wrappedResourceHandlerobject.abstract ResourceA class that implements this interface uses this method to return an instance of the class being wrapped.voidsetContentType(String contentType) The default behavior of this method is to callResource.setContentType(String)on the wrappedResourceHandlerobject.voidsetLibraryName(String libraryName) The default behavior of this method is to callResource.setLibraryName(String)on the wrappedResourceHandlerobject.voidsetResourceName(String resourceName) The default behavior of this method is to callResource.setResourceName(String)on the wrappedResourceHandlerobject.booleanuserAgentNeedsUpdate(FacesContext context) The default behavior of this method is to callResource.userAgentNeedsUpdate(javax.faces.context.FacesContext)on the wrappedResourceHandlerobject.
-
Constructor Details
-
ResourceWrapper
public ResourceWrapper()
-
-
Method Details
-
getWrapped
Description copied from interface:FacesWrapperA class that implements this interface uses this method to return an instance of the class being wrapped.
- Specified by:
getWrappedin interfaceFacesWrapper<Resource>- Returns:
- the instance that we are wrapping.
-
getInputStream
The default behavior of this method is to call
Resource.getInputStream()on the wrappedResourceHandlerobject.- Specified by:
getInputStreamin classResource- Returns:
- an
InputStreamcontaining the bytes of the resource.Any EL expressions present in the resource must be evaluated before serving the bytes of the resource. Note that due to browser and server caching, EL expressions in a resource file will generally only be evaluated once, when the resource is first served up. Therefore, using EL expressions that refer to per-request data is not advisable since this data can become stale.
- Throws:
IOException- if the current request is not a resource request.
-
getURL
The default behavior of this method is to call
Resource.getURL()on the wrappedResourceHandlerobject. -
getResponseHeaders
The default behavior of this method is to call
Resource.getResponseHeaders()on the wrappedResourceHandlerobject.- Specified by:
getResponseHeadersin classResource- Returns:
- a mutable
Map<String, String>of headers that will be included with the response.
-
getRequestPath
The default behavior of this method is to call
Resource.getRequestPath()on the wrappedResourceHandlerobject.- Specified by:
getRequestPathin classResource- Returns:
- the path to this resource, intended to be included in the encoded view that is sent to the browser when sending a faces response.
-
userAgentNeedsUpdate
The default behavior of this method is to call
Resource.userAgentNeedsUpdate(javax.faces.context.FacesContext)on the wrappedResourceHandlerobject.- Specified by:
userAgentNeedsUpdatein classResource- Returns:
trueorfalsedepending on whether or not the user-agent needs an update of this resource.
-
getContentType
The default behavior of this method is to call
Resource.getContentType()on the wrappedResourceHandlerobject.- Overrides:
getContentTypein classResource- Returns:
- the MIME content-type for this resource.
-
setContentType
The default behavior of this method is to call
Resource.setContentType(String)on the wrappedResourceHandlerobject.- Overrides:
setContentTypein classResource- Parameters:
contentType- the MIME content-type for this resource. The default implementation must acceptnullas a parameter.
-
getLibraryName
The default behavior of this method is to call
Resource.getLibraryName()on the wrappedResourceHandlerobject.- Overrides:
getLibraryNamein classResource- Returns:
- Return the libraryName for this resource. May be
null.
-
setLibraryName
The default behavior of this method is to call
Resource.setLibraryName(String)on the wrappedResourceHandlerobject.- Overrides:
setLibraryNamein classResource- Parameters:
libraryName- the libraryName for this resource. The default implementation must acceptnullfor the libraryName.
-
getResourceName
The default behavior of this method is to call
Resource.getResourceName()on the wrappedResourceHandlerobject.- Overrides:
getResourceNamein classResource- Returns:
- Return the resourceName for this resource. Will never be null.
-
setResourceName
The default behavior of this method is to call
Resource.setResourceName(String)on the wrappedResourceHandlerobject.- Overrides:
setResourceNamein classResource- Parameters:
resourceName- a non-null String.
-