public abstract class ResourceHandlerWrapper extends ResourceHandler implements 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.
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 and Description |
---|
ResourceHandlerWrapper() |
Modifier and Type | Method and Description |
---|---|
Resource |
createResource(String resourceName)
The default behavior of this method
is to call |
Resource |
createResource(String resourceName,
String libraryName)
The default behavior of this method
is to call |
Resource |
createResource(String resourceName,
String libraryName,
String contentType)
The default behavior of this method
is to call |
Resource |
createResourceFromId(String resourceId)
The default behavior of this method
is to call |
ViewResource |
createViewResource(FacesContext context,
String resourceName)
The default behavior of this method
is to call |
String |
getRendererTypeForResourceName(String resourceName)
The default behavior of this method
is to call |
abstract ResourceHandler |
getWrapped()
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 call |
boolean |
isResourceRequest(FacesContext context)
The default behavior of this method
is to call |
boolean |
isResourceURL(String url)
The default behavior of this method
is to call |
boolean |
libraryExists(String libraryName)
The default behavior of this method
is to call |
public abstract ResourceHandler getWrapped()
FacesWrapper
A class that implements this interface uses this method to return an instance of the class being wrapped.
getWrapped
in interface FacesWrapper<ResourceHandler>
public Resource createResource(String resourceName)
The default behavior of this method
is to call ResourceHandler.createResource(String)
on the
wrapped ResourceHandler
object.
createResource
in class ResourceHandler
resourceName
- the name of the resource.Resource
instance, suitable
for use in encoding or decoding the named resource.public Resource createResourceFromId(String resourceId)
The default behavior of this method
is to call ResourceHandler.createResourceFromId(String)
on the
wrapped ResourceHandler
object.
createResourceFromId
in class ResourceHandler
resourceId
- the resource identifier of the resource.Resource
instance, suitable
for use in encoding or decoding the named resource.public Resource createResource(String resourceName, String libraryName)
The default behavior of this method
is to call ResourceHandler.createResource(String, String)
on the wrapped
ResourceHandler
object.
createResource
in class ResourceHandler
resourceName
- the name of the resource.libraryName
- the
name of the library (or contract) in which this resource
resides, may be null
. 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 "../".Resource
instance, suitable
for use in encoding or decoding the named resource.public ViewResource createViewResource(FacesContext context, String resourceName)
The default behavior of this method
is to call ResourceHandler.createViewResource(javax.faces.context.FacesContext, java.lang.String)
on the wrapped
ResourceHandler
object.
createViewResource
in class ResourceHandler
context
- the FacesContext
for this request.resourceName
- the name of the resource to be interpreted as a view
by the ViewDeclarationLanguage
.ViewResource
instance, suitable
for use by the ViewDeclarationLanguage
.public Resource createResource(String resourceName, String libraryName, String contentType)
The default behavior of this method
is to call ResourceHandler.createResource(String, String,
String)
on the wrapped ResourceHandler
object.
createResource
in class ResourceHandler
resourceName
- the name of the resource.libraryName
- the name of the library in which this resource
resides, may be null
. May not include relative
paths, such as "../".contentType
- the mime content that this
Resource
instance will return from Resource.getContentType()
. If the value is null
, The
content-type of the resource is derived by passing the
resourceName to ExternalContext.getMimeType(java.lang.String)
Resource
instance, suitable
for use in encoding or decoding the named resource.public void handleResourceRequest(FacesContext context) throws IOException
The default behavior of this method
is to call ResourceHandler.handleResourceRequest(javax.faces.context.FacesContext)
on the wrapped ResourceHandler
object.
handleResourceRequest
in class ResourceHandler
context
- the FacesContext
for this
requestIOException
public boolean isResourceRequest(FacesContext context)
The default behavior of this method
is to call ResourceHandler.isResourceRequest(javax.faces.context.FacesContext)
on the
wrapped ResourceHandler
object.
isResourceRequest
in class ResourceHandler
context
- the FacesContext
for this
requesttrue
if the current request is a resource
request, false
otherwise.public boolean isResourceURL(String url)
The default behavior of this method
is to call ResourceHandler.isResourceURL(java.lang.String)
on the
wrapped ResourceHandler
object.
isResourceURL
in class ResourceHandler
url
- the url to inspect for the presence of ResourceHandler.RESOURCE_IDENTIFIER
.public boolean libraryExists(String libraryName)
The default behavior of this method
is to call ResourceHandler.libraryExists(String)
on the
wrapped ResourceHandler
object.
libraryExists
in class ResourceHandler
public String getRendererTypeForResourceName(String resourceName)
The default behavior of this method
is to call ResourceHandler.getRendererTypeForResourceName(String)
on the
wrapped ResourceHandler
object.
getRendererTypeForResourceName
in class ResourceHandler
Copyright © 1996-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.