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. |
| Modifier and Type | Method and Description |
|---|---|
Resource |
createResource(java.lang.String resourceName)
The default behavior of this method is to call |
Resource |
createResource(java.lang.String resourceName,
java.lang.String libraryName)
The default behavior of this method is to call
|
Resource |
createResource(java.lang.String resourceName,
java.lang.String libraryName,
java.lang.String contentType)
The default behavior of this method is to call
|
Resource |
createResourceFromId(java.lang.String resourceId)
The default behavior of this method is to call
|
ViewResource |
createViewResource(FacesContext context,
java.lang.String resourceName)
The default behavior of this method is to call |
java.lang.String |
getRendererTypeForResourceName(java.lang.String resourceName)
The default behavior of this method is to call
|
java.util.stream.Stream<java.lang.String> |
getViewResources(FacesContext facesContext,
java.lang.String path,
int maxDepth,
ResourceVisitOption... options)
The default behavior of this method is to call
|
java.util.stream.Stream<java.lang.String> |
getViewResources(FacesContext facesContext,
java.lang.String path,
ResourceVisitOption... options)
The default behavior of this method is to call
|
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 |
isResourceRendered(FacesContext context,
java.lang.String resourceName,
java.lang.String libraryName)
The default behavior of this method is to call
|
boolean |
isResourceRequest(FacesContext context)
The default behavior of this method is to call
|
boolean |
isResourceURL(java.lang.String url)
The default behavior of this method is to call |
boolean |
libraryExists(java.lang.String libraryName)
The default behavior of this method is to call |
void |
markResourceRendered(FacesContext context,
java.lang.String resourceName,
java.lang.String libraryName)
The default behavior of this method is to call
|
@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()
FacesWrapperA 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(java.lang.String resourceName)
The default behavior of this method is to call ResourceHandler.createResource(String)
on the wrapped ResourceHandler object.
createResource in class ResourceHandlerresourceName - the name of the resource.Resource instance, suitable for use in encoding or
decoding the named resource.public Resource createResourceFromId(java.lang.String resourceId)
The default behavior of this method is to call
ResourceHandler.createResourceFromId(String) on the wrapped ResourceHandler
object.
createResourceFromId in class ResourceHandlerresourceId - the resource identifier of the resource.Resource instance, suitable for use in encoding or
decoding the named resource.public Resource createResource(java.lang.String resourceName, java.lang.String libraryName)
The default behavior of this method is to call
ResourceHandler.createResource(String, String) on the wrapped ResourceHandler
object.
createResource in class ResourceHandlerresourceName - 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, java.lang.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 ResourceHandlercontext - 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 java.util.stream.Stream<java.lang.String> getViewResources(FacesContext facesContext, java.lang.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 ResourceHandlerfacesContext - 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 java.util.stream.Stream<java.lang.String> getViewResources(FacesContext facesContext, java.lang.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 ResourceHandlerfacesContext - 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(java.lang.String resourceName, java.lang.String libraryName, java.lang.String contentType)
The default behavior of this method is to call
ResourceHandler.createResource(String, String, String) on the wrapped
ResourceHandler object.
createResource in class ResourceHandlerresourceName - 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 java.io.IOException
The default behavior of this method is to call
ResourceHandler.handleResourceRequest(javax.faces.context.FacesContext) on the
wrapped ResourceHandler object.
handleResourceRequest in class ResourceHandlercontext - the FacesContext for this requestjava.io.IOException - 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 ResourceHandlercontext - the FacesContext for this requesttrue if the current request is a resource request, false
otherwise.public boolean isResourceURL(java.lang.String url)
The default behavior of this method is to call ResourceHandler.isResourceURL(java.lang.String) on the
wrapped ResourceHandler object.
isResourceURL in class ResourceHandlerurl - the url to inspect for the presence of
ResourceHandler.RESOURCE_IDENTIFIER.true if this is a resource URL, false otherwise.public boolean libraryExists(java.lang.String libraryName)
The default behavior of this method is to call ResourceHandler.libraryExists(String)
on the wrapped ResourceHandler object.
libraryExists in class ResourceHandlerlibraryName - the library name.true if the library exists, false otherwise.public java.lang.String getRendererTypeForResourceName(java.lang.String resourceName)
The default behavior of this method is to call
ResourceHandler.getRendererTypeForResourceName(String) on the wrapped
ResourceHandler object.
getRendererTypeForResourceName in class ResourceHandlerresourceName - the resource name.public void markResourceRendered(FacesContext context, java.lang.String resourceName, java.lang.String libraryName)
The default behavior of this method is to call
ResourceHandler.markResourceRendered(FacesContext, String, String) on the wrapped
ResourceHandler object.
markResourceRendered in class ResourceHandlercontext - 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, java.lang.String resourceName, java.lang.String libraryName)
The default behavior of this method is to call
ResourceHandler.isResourceRendered(FacesContext, String, String) on the wrapped
ResourceHandler object.
isResourceRendered in class ResourceHandlercontext - 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.