Top Description Fields Constructors Methods
jakarta.faces.application

public abstract Class ResourceHandlerWrapper

extends ResourceHandler
implements FacesWrapper<ResourceHandler>
Class Inheritance
All Implemented Interfaces
jakarta.faces.FacesWrapper
Imports
java.io.IOException, java.util.stream.Stream, jakarta.faces.FacesWrapper, jakarta.faces.context.FacesContext

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.

Since
2.0

Field Summary

Modifier and TypeField and Description
private ResourceHandler
Inherited from jakarta.faces.application.ResourceHandler:
FACES_SCRIPT_LIBRARY_NAMEFACES_SCRIPT_RESOURCE_NAMEJSF_SCRIPT_LIBRARY_NAMEJSF_SCRIPT_RESOURCE_NAMELOCALE_PREFIXRESOURCE_CONTRACT_XMLRESOURCE_EXCLUDES_DEFAULT_VALUERESOURCE_EXCLUDES_PARAM_NAMERESOURCE_IDENTIFIERWEBAPP_CONTRACTS_DIRECTORY_PARAM_NAMEWEBAPP_RESOURCES_DIRECTORY_PARAM_NAME

Constructor Summary

AccessConstructor and Description
public
ResourceHandlerWrapper()
Deprecated Use the other constructor taking the implementation being wrapped.

public
ResourceHandlerWrapper(ResourceHandler
The implementation being wrapped.
wrapped
)

If this resource handler has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor.

Method Summary

Modifier and TypeMethod and Description
public Resource
createResource(String
the name of the resource.
resourceName
)

Implements abstract jakarta.faces.application.ResourceHandler.createResource.

The default behavior of this method is to call ResourceHandler#createResource(String) on the wrapped ResourceHandler object.

public Resource
createResource(String
the name of the resource.
resourceName
,
String
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 "../".
libraryName
)

Implements abstract jakarta.faces.application.ResourceHandler.createResource.

The default behavior of this method is to call ResourceHandler#createResource(String, String) on the wrapped ResourceHandler object.

public Resource
createResource(String
the name of the resource.
resourceName
,
String
the name of the library in which this resource resides, may be null. May not include relative paths, such as "../".
libraryName
,
String
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 jakarta.faces.context.ExternalContext#getMimeType
contentType
)

Implements abstract jakarta.faces.application.ResourceHandler.createResource.

The default behavior of this method is to call ResourceHandler#createResource(String, String, String) on the wrapped ResourceHandler object.

public Resource
createResourceFromId(String
the resource identifier of the resource.
resourceId
)

Overrides jakarta.faces.application.ResourceHandler.createResourceFromId.

The default behavior of this method is to call ResourceHandler#createResourceFromId(String) on the wrapped ResourceHandler object.

public ViewResource
createViewResource(FacesContext
the FacesContext for this request.
context
,
String
the name of the resource to be interpreted as a view by the jakarta.faces.view.ViewDeclarationLanguage.
resourceName
)

Overrides jakarta.faces.application.ResourceHandler.createViewResource.

The default behavior of this method is to call ResourceHandler#createViewResource on the wrapped ResourceHandler object.

public String
getRendererTypeForResourceName(String
the resource name.
resourceName
)

Implements abstract jakarta.faces.application.ResourceHandler.getRendererTypeForResourceName.

The default behavior of this method is to call ResourceHandler#getRendererTypeForResourceName(String) on the wrapped ResourceHandler object.

public Stream<String>
getViewResources(FacesContext
The FacesContext for this request.
facesContext
,
String
The initial path from which to start looking for view resources
path
,
int
The absolute maximum depth of nested directories to visit counted from the root (/).
maxDepth
,
ResourceVisitOption...
The options to influence the traversal. See ResourceVisitOption for details on those.
options
)

Overrides jakarta.faces.application.ResourceHandler.getViewResources.

The default behavior of this method is to call ResourceHandler#getViewResources(FacesContext, String, int, ResourceVisitOption...) on the wrapped ResourceHandler object.

public Stream<String>
getViewResources(FacesContext
The FacesContext for this request.
facesContext
,
String
The initial path from which to start looking for view resources
path
,
ResourceVisitOption...
The options to influence the traversal. See ResourceVisitOption for details on those.
options
)

Overrides jakarta.faces.application.ResourceHandler.getViewResources.

The default behavior of this method is to call ResourceHandler#getViewResources(FacesContext, String, ResourceVisitOption...) on the wrapped ResourceHandler object.

public ResourceHandler
getWrapped()

Implements jakarta.faces.FacesWrapper.getWrapped.

A class that implements this interface uses this method to return an instance of the class being wrapped.

public void
public boolean
isResourceRendered(FacesContext
The FacesContext for this request.
context
,
String
The name of the resource.
resourceName
,
String
The name of the library in which this resource resides, may be null.
libraryName
)

Overrides jakarta.faces.application.ResourceHandler.isResourceRendered.

The default behavior of this method is to call ResourceHandler#isResourceRendered(FacesContext, String, String) on the wrapped ResourceHandler object.

public boolean
public boolean
isResourceURL(String
the url to inspect for the presence of ResourceHandler#RESOURCE_IDENTIFIER.
url
)

Overrides jakarta.faces.application.ResourceHandler.isResourceURL.

The default behavior of this method is to call ResourceHandler#isResourceURL on the wrapped ResourceHandler object.

public boolean
libraryExists(String
the library name.
libraryName
)

Implements abstract jakarta.faces.application.ResourceHandler.libraryExists.

The default behavior of this method is to call ResourceHandler#libraryExists(String) on the wrapped ResourceHandler object.

public void
markResourceRendered(FacesContext
The FacesContext for this request.
context
,
String
The name of the resource.
resourceName
,
String
The name of the library in which the resource resides, may be null.
libraryName
)

Overrides jakarta.faces.application.ResourceHandler.markResourceRendered.

The default behavior of this method is to call ResourceHandler#markResourceRendered(FacesContext, String, String) on the wrapped ResourceHandler object.

Field Detail

wrappedback to summary
private ResourceHandler wrapped

Constructor Detail

ResourceHandlerWrapperback to summary
public ResourceHandlerWrapper()

Deprecated

Use the other constructor taking the implementation being wrapped.

Annotations
@Deprecated
ResourceHandlerWrapperback to summary
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.

Parameters
wrapped:ResourceHandler

The implementation being wrapped.

Since
2.3

Method Detail

createResourceback to summary
public Resource createResource(String resourceName)

Implements abstract jakarta.faces.application.ResourceHandler.createResource.

The default behavior of this method is to call ResourceHandler#createResource(String) on the wrapped ResourceHandler object.

Parameters
resourceName:String

Doc from jakarta.faces.application.ResourceHandler.createResource.

the name of the resource.

Returns:Resource

Doc from jakarta.faces.application.ResourceHandler.createResource.

a newly created Resource instance, suitable for use in encoding or decoding the named resource.

Annotations
@Override
createResourceback to summary
public Resource createResource(String resourceName, String libraryName)

Implements abstract jakarta.faces.application.ResourceHandler.createResource.

The default behavior of this method is to call ResourceHandler#createResource(String, String) on the wrapped ResourceHandler object.

Parameters
resourceName:String

Doc from jakarta.faces.application.ResourceHandler.createResource.

the name of the resource.

libraryName:String

Doc from jakarta.faces.application.ResourceHandler.createResource.

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 "../".

Returns:Resource

Doc from jakarta.faces.application.ResourceHandler.createResource.

a newly created Resource instance, suitable for use in encoding or decoding the named resource.

Annotations
@Override
createResourceback to summary
public Resource createResource(String resourceName, String libraryName, String contentType)

Implements abstract jakarta.faces.application.ResourceHandler.createResource.

The default behavior of this method is to call ResourceHandler#createResource(String, String, String) on the wrapped ResourceHandler object.

Parameters
resourceName:String

Doc from jakarta.faces.application.ResourceHandler.createResource.

the name of the resource.

libraryName:String

Doc from jakarta.faces.application.ResourceHandler.createResource.

the name of the library in which this resource resides, may be null. May not include relative paths, such as "../".

contentType:String

Doc from jakarta.faces.application.ResourceHandler.createResource.

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 jakarta.faces.context.ExternalContext#getMimeType

Returns:Resource

Doc from jakarta.faces.application.ResourceHandler.createResource.

a newly created Resource instance, suitable for use in encoding or decoding the named resource.

Annotations
@Override
createResourceFromIdback to summary
public Resource createResourceFromId(String resourceId)

Overrides jakarta.faces.application.ResourceHandler.createResourceFromId.

The default behavior of this method is to call ResourceHandler#createResourceFromId(String) on the wrapped ResourceHandler object.

Parameters
resourceId:String

Doc from jakarta.faces.application.ResourceHandler.createResourceFromId.

the resource identifier of the resource.

Returns:Resource

Doc from jakarta.faces.application.ResourceHandler.createResourceFromId.

a newly created Resource instance, suitable for use in encoding or decoding the named resource.

Annotations
@Override
Since
2.2
createViewResourceback to summary
public ViewResource createViewResource(FacesContext context, String resourceName)

Overrides jakarta.faces.application.ResourceHandler.createViewResource.

The default behavior of this method is to call ResourceHandler#createViewResource on the wrapped ResourceHandler object.

Parameters
context:FacesContext

Doc from jakarta.faces.application.ResourceHandler.createViewResource.

the FacesContext for this request.

resourceName:String

Doc from jakarta.faces.application.ResourceHandler.createViewResource.

the name of the resource to be interpreted as a view by the jakarta.faces.view.ViewDeclarationLanguage.

Returns:ViewResource

Doc from jakarta.faces.application.ResourceHandler.createViewResource.

a newly created ViewResource instance, suitable for use by the jakarta.faces.view.ViewDeclarationLanguage.

Annotations
@Override
getRendererTypeForResourceNameback to summary
public String getRendererTypeForResourceName(String resourceName)

Implements abstract jakarta.faces.application.ResourceHandler.getRendererTypeForResourceName.

The default behavior of this method is to call ResourceHandler#getRendererTypeForResourceName(String) on the wrapped ResourceHandler object.

Parameters
resourceName:String

Doc from jakarta.faces.application.ResourceHandler.getRendererTypeForResourceName.

the resource name.

Returns:String

Doc from jakarta.faces.application.ResourceHandler.getRendererTypeForResourceName.

the renderer type.

Annotations
@Override
getViewResourcesback to summary
public Stream<String> getViewResources(FacesContext facesContext, String path, int maxDepth, ResourceVisitOption... options)

Overrides jakarta.faces.application.ResourceHandler.getViewResources.

The default behavior of this method is to call ResourceHandler#getViewResources(FacesContext, String, int, ResourceVisitOption...) on the wrapped ResourceHandler object.

Parameters
facesContext:FacesContext

Doc from jakarta.faces.application.ResourceHandler.getViewResources.

The FacesContext for this request.

path:String

Doc from jakarta.faces.application.ResourceHandler.getViewResources.

The initial path from which to start looking for view resources

maxDepth:int

Doc from jakarta.faces.application.ResourceHandler.getViewResources.

The absolute maximum depth of nested directories to visit counted from the root (/).

options:ResourceVisitOption[]

Doc from jakarta.faces.application.ResourceHandler.getViewResources.

The options to influence the traversal. See ResourceVisitOption for details on those.

Returns:Stream<String>

Doc from jakarta.faces.application.ResourceHandler.getViewResources.

the Stream of view resource names

Annotations
@Override
Since
2.3
getViewResourcesback to summary
public Stream<String> getViewResources(FacesContext facesContext, String path, ResourceVisitOption... options)

Overrides jakarta.faces.application.ResourceHandler.getViewResources.

The default behavior of this method is to call ResourceHandler#getViewResources(FacesContext, String, ResourceVisitOption...) on the wrapped ResourceHandler object.

Parameters
facesContext:FacesContext

Doc from jakarta.faces.application.ResourceHandler.getViewResources.

The FacesContext for this request.

path:String

Doc from jakarta.faces.application.ResourceHandler.getViewResources.

The initial path from which to start looking for view resources

options:ResourceVisitOption[]

Doc from jakarta.faces.application.ResourceHandler.getViewResources.

The options to influence the traversal. See ResourceVisitOption for details on those.

Returns:Stream<String>

Doc from jakarta.faces.application.ResourceHandler.getViewResources.

the Stream of view resource names

Annotations
@Override
Since
2.3
getWrappedback to summary
public ResourceHandler getWrapped()

Implements jakarta.faces.FacesWrapper.getWrapped.

Doc from jakarta.faces.FacesWrapper.getWrapped.

A class that implements this interface uses this method to return an instance of the class being wrapped.

Returns:ResourceHandler

the wrapped instance.

Annotations
@Override
handleResourceRequestback to summary
public void handleResourceRequest(FacesContext context) throws IOException

Implements abstract jakarta.faces.application.ResourceHandler.handleResourceRequest.

The default behavior of this method is to call ResourceHandler#handleResourceRequest(jakarta.faces.context.FacesContext) on the wrapped ResourceHandler object.

Parameters
context:FacesContext

Doc from jakarta.faces.application.ResourceHandler.handleResourceRequest.

the jakarta.faces.context.FacesContext for this request

Annotations
@Override
Exceptions
IOException:

Doc from jakarta.faces.application.ResourceHandler.handleResourceRequest.

when an I/O error occurs.

isResourceRenderedback to summary
public boolean isResourceRendered(FacesContext context, String resourceName, String libraryName)

Overrides jakarta.faces.application.ResourceHandler.isResourceRendered.

The default behavior of this method is to call ResourceHandler#isResourceRendered(FacesContext, String, String) on the wrapped ResourceHandler object.

Parameters
context:FacesContext

Doc from jakarta.faces.application.ResourceHandler.isResourceRendered.

The FacesContext for this request.

resourceName:String

Doc from jakarta.faces.application.ResourceHandler.isResourceRendered.

The name of the resource.

libraryName:String

Doc from jakarta.faces.application.ResourceHandler.isResourceRendered.

The name of the library in which this resource resides, may be null.

Returns:boolean

Doc from jakarta.faces.application.ResourceHandler.isResourceRendered.

Whether the resource as identified by given resource and library name has been rendered.

Annotations
@Override
Since
2.3
isResourceRequestback to summary
public boolean isResourceRequest(FacesContext context)

Implements abstract jakarta.faces.application.ResourceHandler.isResourceRequest.

The default behavior of this method is to call ResourceHandler#isResourceRequest(jakarta.faces.context.FacesContext) on the wrapped ResourceHandler object.

Parameters
context:FacesContext

Doc from jakarta.faces.application.ResourceHandler.isResourceRequest.

the jakarta.faces.context.FacesContext for this request

Returns:boolean

Doc from jakarta.faces.application.ResourceHandler.isResourceRequest.

true if the current request is a resource request, false otherwise.

Annotations
@Override
isResourceURLback to summary
public boolean isResourceURL(String url)

Overrides jakarta.faces.application.ResourceHandler.isResourceURL.

The default behavior of this method is to call ResourceHandler#isResourceURL on the wrapped ResourceHandler object.

Parameters
url:String

Doc from jakarta.faces.application.ResourceHandler.isResourceURL.

the url to inspect for the presence of ResourceHandler#RESOURCE_IDENTIFIER.

Returns:boolean

Doc from jakarta.faces.application.ResourceHandler.isResourceURL.

true if this is a resource URL, false otherwise.

Annotations
@Override
libraryExistsback to summary
public boolean libraryExists(String libraryName)

Implements abstract jakarta.faces.application.ResourceHandler.libraryExists.

The default behavior of this method is to call ResourceHandler#libraryExists(String) on the wrapped ResourceHandler object.

Parameters
libraryName:String

Doc from jakarta.faces.application.ResourceHandler.libraryExists.

the library name.

Returns:boolean

Doc from jakarta.faces.application.ResourceHandler.libraryExists.

true if the library exists, false otherwise.

Annotations
@Override
markResourceRenderedback to summary
public void markResourceRendered(FacesContext context, String resourceName, String libraryName)

Overrides jakarta.faces.application.ResourceHandler.markResourceRendered.

The default behavior of this method is to call ResourceHandler#markResourceRendered(FacesContext, String, String) on the wrapped ResourceHandler object.

Parameters
context:FacesContext

Doc from jakarta.faces.application.ResourceHandler.markResourceRendered.

The FacesContext for this request.

resourceName:String

Doc from jakarta.faces.application.ResourceHandler.markResourceRendered.

The name of the resource.

libraryName:String

Doc from jakarta.faces.application.ResourceHandler.markResourceRendered.

The name of the library in which the resource resides, may be null.

Annotations
@Override
Since
2.3