public abstract class ResourceWrapper extends Resource implements FacesWrapper<Resource>
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.
COMPONENT_RESOURCE_KEY| Constructor and Description |
|---|
ResourceWrapper()
Deprecated.
Use the other constructor taking the implementation being wrapped.
|
ResourceWrapper(Resource wrapped)
If this resource has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor. |
| Modifier and Type | Method and Description |
|---|---|
String |
getContentType()
The default behavior of this method is to call |
InputStream |
getInputStream()
The default behavior of this method is to call |
String |
getLibraryName()
The default behavior of this method is to call |
String |
getRequestPath()
The default behavior of this method is to call |
String |
getResourceName()
The default behavior of this method is to call |
Map<String,String> |
getResponseHeaders()
The default behavior of this method is to call |
URL |
getURL()
The default behavior of this method is to call |
Resource |
getWrapped()
A class that implements this interface uses this method to return an instance of the class being wrapped. |
void |
setContentType(String contentType)
The default behavior of this method is to call |
void |
setLibraryName(String libraryName)
The default behavior of this method is to call |
void |
setResourceName(String resourceName)
The default behavior of this method is to call |
boolean |
userAgentNeedsUpdate(FacesContext context)
The default behavior of this method is to call |
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.
wrapped - The implementation being wrapped.@Deprecated public ResourceWrapper()
public Resource getWrapped()
FacesWrapperA class that implements this interface uses this method to return an instance of the class being wrapped.
getWrapped in interface FacesWrapper<Resource>public InputStream getInputStream() throws IOException
The default behavior of this method is to call Resource.getInputStream() on the wrapped ResourceHandler
object.
getInputStream in class ResourceInputStream 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.
IOException - if the current request is not a resource request.public URL getURL()
The default behavior of this method is to call Resource.getURL() on the wrapped ResourceHandler object.
public Map<String,String> getResponseHeaders()
The default behavior of this method is to call Resource.getResponseHeaders() on the wrapped
ResourceHandler object.
getResponseHeaders in class ResourceMap<String, String> of headers that will be included with the response.public String getRequestPath()
The default behavior of this method is to call Resource.getRequestPath() on the wrapped ResourceHandler
object.
getRequestPath in class Resourcepublic boolean userAgentNeedsUpdate(FacesContext context)
The default behavior of this method is to call Resource.userAgentNeedsUpdate(jakarta.faces.context.FacesContext) on the wrapped
ResourceHandler object.
userAgentNeedsUpdate in class Resourcecontext - the Faces context.true or false depending on whether or not the user-agent needs an update of this
resource.public String getContentType()
The default behavior of this method is to call Resource.getContentType() on the wrapped
ResourceHandler object.
getContentType in class Resourcepublic void setContentType(String contentType)
The default behavior of this method is to call Resource.setContentType(String) on the wrapped
ResourceHandler object.
setContentType in class ResourcecontentType - the MIME content-type for this resource. The default implementation must accept null
as a parameter.public String getLibraryName()
The default behavior of this method is to call Resource.getLibraryName() on the wrapped
ResourceHandler object.
getLibraryName in class Resourcenull.public void setLibraryName(String libraryName)
The default behavior of this method is to call Resource.setLibraryName(String) on the wrapped
ResourceHandler object.
setLibraryName in class ResourcelibraryName - the libraryName for this resource. The default implementation must accept null for
the libraryName.public String getResourceName()
The default behavior of this method is to call Resource.getResourceName() on the wrapped
ResourceHandler object.
getResourceName in class Resourcepublic void setResourceName(String resourceName)
The default behavior of this method is to call Resource.setResourceName(String) on the wrapped
ResourceHandler object.
setResourceName in class ResourceresourceName - a non-null String.Copyright © 2018,2020 Eclipse Foundation.
Use is subject to license terms.