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 push the implementation being wrapped to the constructor and use
getWrapped()
to access the instance being wrapped.
JSF_SCRIPT_LIBRARY_NAME, JSF_SCRIPT_RESOURCE_NAME, 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()
Deprecated.
Use the other constructor taking the implementation being wrapped.
|
ResourceHandlerWrapper(ResourceHandler wrapped)
If this resource handler has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor. |
@Deprecated public ResourceHandlerWrapper()
public ResourceHandlerWrapper(ResourceHandler wrapped)
If this resource handler has been decorated, the implementation doing the decorating should
push the implementation being wrapped to this constructor. The getWrapped()
will
then return the implementation being wrapped.
wrapped
- The implementation being wrapped.public 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 Stream<String> getViewResources(FacesContext facesContext, String path, int maxDepth, ResourceVisitOption... options)
The default behavior of this method is to call
ResourceHandler.getViewResources(FacesContext, String, int, ResourceVisitOption...)
on the wrapped ResourceHandler
object.
getViewResources
in class ResourceHandler
facesContext
- The FacesContext
for this request.path
- The initial path from which to start looking for view resourcesmaxDepth
- The absolute maximum depth of nested directories to visit counted from the
root (/
).options
- The options to influence the traversal. See ResourceVisitOption
for
details on those.Stream
of view resource namespublic Stream<String> getViewResources(FacesContext facesContext, String path, ResourceVisitOption... options)
The default behavior of this method is to call
ResourceHandler.getViewResources(FacesContext, String, ResourceVisitOption...)
on the
wrapped ResourceHandler
object.
getViewResources
in class ResourceHandler
facesContext
- The FacesContext
for this request.path
- The initial path from which to start looking for view resourcesoptions
- The options to influence the traversal. See ResourceVisitOption
for
details on those.Stream
of view resource namespublic 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
- when an I/O error occurs.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
.true
if this is a resource URL, false
otherwise.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
libraryName
- the library name.true
if the library exists, false
otherwise.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
resourceName
- the resource name.public void markResourceRendered(FacesContext context, String resourceName, String libraryName)
The default behavior of this method is to call
ResourceHandler.markResourceRendered(FacesContext, String, String)
on the wrapped
ResourceHandler
object.
markResourceRendered
in class ResourceHandler
context
- The FacesContext
for this request.resourceName
- The name of the resource.libraryName
- The name of the library in which the resource resides, may be
null
.public boolean isResourceRendered(FacesContext context, String resourceName, String libraryName)
The default behavior of this method is to call
ResourceHandler.isResourceRendered(FacesContext, String, String)
on the wrapped
ResourceHandler
object.
isResourceRendered
in class ResourceHandler
context
- The FacesContext
for this request.resourceName
- The name of the resource.libraryName
- The name of the library in which this resource resides, may be
null
.Copyright © 2019 Eclipse Foundation.
Use is subject to license terms.