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 override getWrapped()
to return the instance we
are wrapping.
COMPONENT_RESOURCE_KEY
Constructor and Description |
---|
ResourceWrapper() |
Modifier and Type | Method and Description |
---|---|
InputStream |
getInputStream()
The default behavior of this method
is to call |
String |
getRequestPath()
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 |
abstract Resource |
getWrapped()
A class that implements this interface uses this method to return an instance of the class being wrapped. |
boolean |
userAgentNeedsUpdate(FacesContext context)
The default behavior of this method
is to call |
getContentType, getLibraryName, getResourceName, setContentType, setLibraryName, setResourceName, toString
public abstract Resource getWrapped()
FacesWrapper
A 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 Resource
InputStream
containing the bytes of the
resource.
Any EL expressions present in the resource must be evaluated before serving the bytes of the resource. Note that due to browser and server caching, EL expressions in a resource file will generally only be evaluated once, when the resource is first served up. Therefore, using EL 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 Resource
Map<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 Resource
public boolean userAgentNeedsUpdate(FacesContext context)
The default behavior of this method
is to call Resource.userAgentNeedsUpdate(javax.faces.context.FacesContext)
on the wrapped ResourceHandler
object.
userAgentNeedsUpdate
in class Resource
true
or false
depending on
whether or not the user-agent needs an update of this resource.Copyright © 2018 JBoss by Red Hat. All rights reserved.