Class ResourceHandlerWrapper
- All Implemented Interfaces:
FacesWrapper<ResourceHandler>
Provides a simple implementation of
ResourceHandler
that can be subclassed by developers wishing
to provide specialized behavior to an existing ResourceHandler
instance. The default implementation of all methods
is to call through to the wrapped ResourceHandler
.
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.ResourceHandler
LOCALE_PREFIX, RESOURCE_CONTRACT_XML, RESOURCE_EXCLUDES_DEFAULT_VALUE, RESOURCE_EXCLUDES_PARAM_NAME, RESOURCE_IDENTIFIER, WEBAPP_CONTRACTS_DIRECTORY_PARAM_NAME, WEBAPP_RESOURCES_DIRECTORY_PARAM_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateResource
(String resourceName) The default behavior of this method is to callResourceHandler.createResource(String)
on the wrappedResourceHandler
object.createResource
(String resourceName, String libraryName) The default behavior of this method is to callResourceHandler.createResource(String, String)
on the wrappedResourceHandler
object.createResource
(String resourceName, String libraryName, String contentType) The default behavior of this method is to callResourceHandler.createResource(String, String, String)
on the wrappedResourceHandler
object.createResourceFromId
(String resourceId) The default behavior of this method is to callResourceHandler.createResourceFromId(String)
on the wrappedResourceHandler
object.createViewResource
(FacesContext context, String resourceName) The default behavior of this method is to callResourceHandler.createViewResource(javax.faces.context.FacesContext, java.lang.String)
on the wrappedResourceHandler
object.getRendererTypeForResourceName
(String resourceName) The default behavior of this method is to callResourceHandler.getRendererTypeForResourceName(String)
on the wrappedResourceHandler
object.abstract ResourceHandler
A class that implements this interface uses this method to return an instance of the class being wrapped.void
handleResourceRequest
(FacesContext context) The default behavior of this method is to callResourceHandler.handleResourceRequest(javax.faces.context.FacesContext)
on the wrappedResourceHandler
object.boolean
isResourceRequest
(FacesContext context) The default behavior of this method is to callResourceHandler.isResourceRequest(javax.faces.context.FacesContext)
on the wrappedResourceHandler
object.boolean
isResourceURL
(String url) The default behavior of this method is to callResourceHandler.isResourceURL(java.lang.String)
on the wrappedResourceHandler
object.boolean
libraryExists
(String libraryName) The default behavior of this method is to callResourceHandler.libraryExists(String)
on the wrappedResourceHandler
object.
-
Constructor Details
-
ResourceHandlerWrapper
public ResourceHandlerWrapper()
-
-
Method Details
-
getWrapped
Description copied from interface:FacesWrapper
A class that implements this interface uses this method to return an instance of the class being wrapped.
- Specified by:
getWrapped
in interfaceFacesWrapper<ResourceHandler>
- Returns:
- the instance that we are wrapping.
-
createResource
The default behavior of this method is to call
ResourceHandler.createResource(String)
on the wrappedResourceHandler
object.- Specified by:
createResource
in classResourceHandler
- Parameters:
resourceName
- the name of the resource.- Returns:
- a newly created
Resource
instance, suitable for use in encoding or decoding the named resource.
-
createResourceFromId
The default behavior of this method is to call
ResourceHandler.createResourceFromId(String)
on the wrappedResourceHandler
object.- Overrides:
createResourceFromId
in classResourceHandler
- Parameters:
resourceId
- the resource identifier of the resource.- Returns:
- a newly created
Resource
instance, suitable for use in encoding or decoding the named resource. - Since:
- 2.2
-
createResource
The default behavior of this method is to call
ResourceHandler.createResource(String, String)
on the wrappedResourceHandler
object.- Specified by:
createResource
in classResourceHandler
- Parameters:
resourceName
- the name of the resource.libraryName
- the name of the library (or contract) in which this resource resides, may benull
. If there is a conflict between the name of a resource library and a resource library contract, the resource library takes precedence. May not include relative paths, such as "../".- Returns:
- a newly created
Resource
instance, suitable for use in encoding or decoding the named resource.
-
createViewResource
The default behavior of this method is to call
ResourceHandler.createViewResource(javax.faces.context.FacesContext, java.lang.String)
on the wrappedResourceHandler
object.- Overrides:
createViewResource
in classResourceHandler
- Parameters:
context
- theFacesContext
for this request.resourceName
- the name of the resource to be interpreted as a view by theViewDeclarationLanguage
.- Returns:
- a newly created
ViewResource
instance, suitable for use by theViewDeclarationLanguage
.
-
createResource
The default behavior of this method is to call
ResourceHandler.createResource(String, String, String)
on the wrappedResourceHandler
object.- Specified by:
createResource
in classResourceHandler
- Parameters:
resourceName
- the name of the resource.libraryName
- the name of the library in which this resource resides, may benull
. May not include relative paths, such as "../".contentType
- the mime content that thisResource
instance will return fromResource.getContentType()
. If the value isnull
, The content-type of the resource is derived by passing the resourceName toExternalContext.getMimeType(java.lang.String)
- Returns:
- a newly created
Resource
instance, suitable for use in encoding or decoding the named resource.
-
handleResourceRequest
The default behavior of this method is to call
ResourceHandler.handleResourceRequest(javax.faces.context.FacesContext)
on the wrappedResourceHandler
object.- Specified by:
handleResourceRequest
in classResourceHandler
- Parameters:
context
- theFacesContext
for this request- Throws:
IOException
-
isResourceRequest
The default behavior of this method is to call
ResourceHandler.isResourceRequest(javax.faces.context.FacesContext)
on the wrappedResourceHandler
object.- Specified by:
isResourceRequest
in classResourceHandler
- Parameters:
context
- theFacesContext
for this request- Returns:
true
if the current request is a resource request,false
otherwise.
-
isResourceURL
The default behavior of this method is to call
ResourceHandler.isResourceURL(java.lang.String)
on the wrappedResourceHandler
object.- Overrides:
isResourceURL
in classResourceHandler
- Parameters:
url
- the url to inspect for the presence ofResourceHandler.RESOURCE_IDENTIFIER
.
-
libraryExists
The default behavior of this method is to call
ResourceHandler.libraryExists(String)
on the wrappedResourceHandler
object.- Specified by:
libraryExists
in classResourceHandler
-
getRendererTypeForResourceName
The default behavior of this method is to call
ResourceHandler.getRendererTypeForResourceName(String)
on the wrappedResourceHandler
object.- Specified by:
getRendererTypeForResourceName
in classResourceHandler
-