Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.faces.application
Class ResourceWrapper

    java.lang.Object
      javax.faces.application.Resource
          javax.faces.application.ResourceWrapper

All Implemented Interfaces:
  FacesWrapper<Resource>

    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.

Since:
  2.0

Field Summary

Fields inherited from class javax.faces.application.Resource
`COMPONENT_RESOURCE_KEY`

Constructor Summary
`ResourceWrapper()`

Method Summary
`java.io.InputStream` | `getInputStream()` The default behavior of this method is to call `Resource.getInputStream()` on the wrapped `ResourceHandler` object.
`java.lang.String` | `getRequestPath()` The default behavior of this method is to call `Resource.getRequestPath()` on the wrapped `ResourceHandler` object.
`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.
`java.net.URL` | `getURL()` The default behavior of this method is to call `Resource.getURL()` on the wrapped `ResourceHandler` object.
`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 `Resource.userAgentNeedsUpdate(javax.faces.context.FacesContext)` on the wrapped `ResourceHandler` object.

Methods inherited from class javax.faces.application.Resource
`getContentType, getLibraryName, getResourceName, setContentType, setLibraryName, setResourceName, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ResourceWrapper

    public ResourceWrapper()

Method Detail

### getWrapped

    public abstract Resource getWrapped()

  Description copied from interface: `FacesWrapper`

  A class that implements this interface uses this method to return an instance of the class being wrapped.

  Specified by:
    `getWrapped` in interface `FacesWrapper<Resource>`
  Returns:
    the instance that we are wrapping.

### getInputStream

    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.

  Specified by:
    `getInputStream` in class `Resource`
  Returns:
    an `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.

  Throws:
    `java.io.IOException` - if the current request is not a resource request.

### getURL

    public java.net.URL getURL()

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

  Specified by:
    `getURL` in class `Resource`
  Returns:
    Return an actual `URL` instance that refers to this resource instance.

### getResponseHeaders

    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.

  Specified by:
    `getResponseHeaders` in class `Resource`
  Returns:
    a mutable `Map<String, String>` of headers that will be included with the response.

### getRequestPath

    public java.lang.String getRequestPath()

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

  Specified by:
    `getRequestPath` in class `Resource`
  Returns:
    the path to this resource, intended to be included in the encoded view that is sent to the browser when sending a faces response.

### userAgentNeedsUpdate

    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.

  Specified by:
    `userAgentNeedsUpdate` in class `Resource`
  Returns:
    `true` or `false` depending on whether or not the user-agent needs an update of this resource.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2002-2010 Oracle America Inc, Inc. All Rights Reserved.