Top Description Fields Constructors Methods
jakarta.faces.application

public abstract Class ResourceWrapper

extends Resource
implements FacesWrapper<Resource>
Class Inheritance
All Implemented Interfaces
jakarta.faces.FacesWrapper
Imports
java.io.IOException, .InputStream, java.net.URL, java.util.Map, jakarta.faces.FacesWrapper, jakarta.faces.context.FacesContext

Provides a simple implementation of Resource that can be subclassed by developers wishing to provide specialized behavior to an existing Resource instance. The default implementation of all methods is to call through to the wrapped Resource.

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 Resource
Inherited from jakarta.faces.application.Resource:
COMPONENT_RESOURCE_KEY

Constructor Summary

AccessConstructor and Description
public
ResourceWrapper(Resource
The implementation being wrapped.
wrapped
)

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

public
ResourceWrapper()
Deprecated Use the other constructor taking the implementation being wrapped.

Method Summary

Modifier and TypeMethod and Description
public String
getContentType()

Overrides jakarta.faces.application.Resource.getContentType.

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

public InputStream
getInputStream()

Implements abstract jakarta.faces.application.Resource.getInputStream.

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

public String
getLibraryName()

Overrides jakarta.faces.application.Resource.getLibraryName.

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

public String
getRequestPath()

Implements abstract jakarta.faces.application.Resource.getRequestPath.

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

public String
getResourceName()

Overrides jakarta.faces.application.Resource.getResourceName.

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

public Map<String, String>
getResponseHeaders()

Implements abstract jakarta.faces.application.Resource.getResponseHeaders.

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

public URL
getURL()

Implements abstract jakarta.faces.application.Resource.getURL.

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

public Resource
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
setContentType(String
the MIME content-type for this resource. The default implementation must accept null as a parameter.
contentType
)

Overrides jakarta.faces.application.Resource.setContentType.

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

public void
setLibraryName(String
the libraryName for this resource. The default implementation must accept null for the libraryName.
libraryName
)

Overrides jakarta.faces.application.Resource.setLibraryName.

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

public void
setResourceName(String
a non-null String.
resourceName
)

Overrides jakarta.faces.application.Resource.setResourceName.

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

public boolean
userAgentNeedsUpdate(FacesContext
the Faces context.
context
)

Implements abstract jakarta.faces.application.Resource.userAgentNeedsUpdate.

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

Inherited from jakarta.faces.application.Resource:
toString

Field Detail

wrappedback to summary
private Resource wrapped

Constructor Detail

ResourceWrapperback to summary
public ResourceWrapper(Resource wrapped)

If this resource 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:Resource

The implementation being wrapped.

Since
2.3
ResourceWrapperback to summary
public ResourceWrapper()

Deprecated

Use the other constructor taking the implementation being wrapped.

Annotations
@Deprecated

Method Detail

getContentTypeback to summary
public String getContentType()

Overrides jakarta.faces.application.Resource.getContentType.

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

Returns:String

Doc from jakarta.faces.application.Resource.getContentType.

the MIME content-type for this resource.

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream() throws IOException

Implements abstract jakarta.faces.application.Resource.getInputStream.

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

Returns:InputStream

Doc from jakarta.faces.application.Resource.getInputStream.

an InputStream containing the bytes of the resource.

Any Jakarta Expression Language expressions present in the resource must be evaluated before serving the bytes of the resource. Note that due to browser and server caching, Jakarta Expression Language expressions in a resource file will generally only be evaluated once, when the resource is first served up. Therefore, using Jakarta Expression Language expressions that refer to per-request data is not advisable since this data can become stale.

Annotations
@Override
Exceptions
IOException:

Doc from jakarta.faces.application.Resource.getInputStream.

if the current request is not a resource request.

getLibraryNameback to summary
public String getLibraryName()

Overrides jakarta.faces.application.Resource.getLibraryName.

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

Returns:String

Doc from jakarta.faces.application.Resource.getLibraryName.

Return the libraryName for this resource. May be null.

Annotations
@Override
getRequestPathback to summary
public String getRequestPath()

Implements abstract jakarta.faces.application.Resource.getRequestPath.

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

Returns:String

Doc from jakarta.faces.application.Resource.getRequestPath.

the path to this resource, intended to be included in the encoded view that is sent to the browser when sending a faces response.

Annotations
@Override
getResourceNameback to summary
public String getResourceName()

Overrides jakarta.faces.application.Resource.getResourceName.

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

Returns:String

Doc from jakarta.faces.application.Resource.getResourceName.

Return the resourceName for this resource. Will never be null.

Annotations
@Override
getResponseHeadersback to summary
public Map<String, String> getResponseHeaders()

Implements abstract jakarta.faces.application.Resource.getResponseHeaders.

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

Returns:Map<String, String>

Doc from jakarta.faces.application.Resource.getResponseHeaders.

a mutable Map<String, String> of headers that will be included with the response.

Annotations
@Override
getURLback to summary
public URL getURL()

Implements abstract jakarta.faces.application.Resource.getURL.

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

Returns:URL

Doc from jakarta.faces.application.Resource.getURL.

Return an actual URL instance that refers to this resource instance.

Annotations
@Override
getWrappedback to summary
public Resource 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:Resource

the wrapped instance.

Annotations
@Override
setContentTypeback to summary
public void setContentType(String contentType)

Overrides jakarta.faces.application.Resource.setContentType.

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

Parameters
contentType:String

Doc from jakarta.faces.application.Resource.setContentType.

the MIME content-type for this resource. The default implementation must accept null as a parameter.

Annotations
@Override
setLibraryNameback to summary
public void setLibraryName(String libraryName)

Overrides jakarta.faces.application.Resource.setLibraryName.

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

Parameters
libraryName:String

Doc from jakarta.faces.application.Resource.setLibraryName.

the libraryName for this resource. The default implementation must accept null for the libraryName.

Annotations
@Override
setResourceNameback to summary
public void setResourceName(String resourceName)

Overrides jakarta.faces.application.Resource.setResourceName.

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

Parameters
resourceName:String

Doc from jakarta.faces.application.Resource.setResourceName.

a non-null String.

Annotations
@Override
userAgentNeedsUpdateback to summary
public boolean userAgentNeedsUpdate(FacesContext context)

Implements abstract jakarta.faces.application.Resource.userAgentNeedsUpdate.

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

Parameters
context:FacesContext

Doc from jakarta.faces.application.Resource.userAgentNeedsUpdate.

the Faces context.

Returns:boolean

Doc from jakarta.faces.application.Resource.userAgentNeedsUpdate.

true or false depending on whether or not the user-agent needs an update of this resource.

Annotations
@Override