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 |
---|---|
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 |
abstract 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 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.public 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(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 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(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 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(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.Copyright © 1996-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.