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 |
---|---|
java.lang.String |
getContentType()
The default behavior of this method is to call
|
java.io.InputStream |
getInputStream()
The default behavior of this method
is to call |
java.lang.String |
getLibraryName()
The default behavior of this method is to call
|
java.lang.String |
getRequestPath()
The default behavior of this method
is to call |
java.lang.String |
getResourceName()
The default behavior of this method is to call
|
java.util.Map<java.lang.String,java.lang.String> |
getResponseHeaders()
The default behavior of this method
is to call |
java.net.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(java.lang.String contentType)
The default behavior of this method is to call
|
void |
setLibraryName(java.lang.String libraryName)
The default behavior of this method is to call
|
void |
setResourceName(java.lang.String resourceName)
The default behavior of this method is to call
|
boolean |
userAgentNeedsUpdate(FacesContext context)
The default behavior of this method
is to call |
@Deprecated public ResourceWrapper()
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.public 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 java.io.InputStream getInputStream() throws java.io.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.
java.io.IOException
- if the current request is not a resource request.public java.net.URL getURL()
The default behavior of this method
is to call Resource.getURL()
on the wrapped ResourceHandler
object.
public java.util.Map<java.lang.String,java.lang.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 java.lang.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
context
- the Faces context.true
or false
depending on
whether or not the user-agent needs an update of this resource.public java.lang.String getContentType()
The default behavior of this method is to call
Resource.getContentType()
on the wrapped ResourceHandler
object.
getContentType
in class Resource
public void setContentType(java.lang.String contentType)
The default behavior of this method is to call
Resource.setContentType(String)
on the wrapped ResourceHandler
object.
setContentType
in class Resource
contentType
- the MIME content-type for this resource. The
default implementation must accept null
as a
parameter.public java.lang.String getLibraryName()
The default behavior of this method is to call
Resource.getLibraryName()
on the wrapped ResourceHandler
object.
getLibraryName
in class Resource
null
.public void setLibraryName(java.lang.String libraryName)
The default behavior of this method is to call
Resource.setLibraryName(String)
on the wrapped ResourceHandler
object.
setLibraryName
in class Resource
libraryName
- the libraryName for this resource. The
default implementation must accept null
for the
libraryName.public java.lang.String getResourceName()
The default behavior of this method is to call
Resource.getResourceName()
on the wrapped ResourceHandler
object.
getResourceName
in class Resource
public void setResourceName(java.lang.String resourceName)
The default behavior of this method is to call
Resource.setResourceName(String)
on the wrapped ResourceHandler
object.
setResourceName
in class Resource
resourceName
- a non-null String.Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms