javax.portlet.filter

## Class PortletResponseWrapper

- java.lang.Object
- - javax.portlet.filter.PortletResponseWrapper

All Implemented Interfaces:
  PortletResponse

Direct Known Subclasses:
  ActionResponseWrapper, EventResponseWrapper, RenderResponseWrapper, ResourceResponseWrapper

    public class PortletResponseWrapper
    extends Object
    implements PortletResponse

The `PortletResponseWrapper` provides a convenient implementation of the `PortletResponse` interface and is extended by other response wrappers. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped response object.

Since:
  2.0
See Also:
  `PortletResponse`

### Constructor Summary

Constructors
Constructor and Description
`PortletResponseWrapper(PortletResponse response)` Creates an `ActionResponse` adaptor wrapping the given response object.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addProperty(javax.servlet.http.Cookie cookie)` The default behavior of this method is to call `addProperty()` on the wrapped response object.
`void` `addProperty(String key, Element element)` The default behavior of this method is to call `addProperty()` on the wrapped response object.
`void` `addProperty(String key, String value)` The default behavior of this method is to call `addProperty(key, value)` on the wrapped response object.
`Element` `createElement(String tagName)` The default behavior of this method is to call `createElement()` on the wrapped response object.
`String` `encodeURL(String path)` The default behavior of this method is to call `encodeURL(path)` on the wrapped response object.
`String` `getNamespace()` The default behavior of this method is to call `getNamespace()` on the wrapped response object.
`PortletResponse` `getResponse()` Return the wrapped response object.
`void` `setProperty(String key, String value)` The default behavior of this method is to call `setProperty(key, value)` on the wrapped response object.
`void` `setResponse(PortletResponse response)` Sets the response object being wrapped.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PortletResponseWrapper

    public PortletResponseWrapper(PortletResponse response)

Creates an `ActionResponse` adaptor wrapping the given response object.

Parameters:
  `response` - the action response to wrap
Throws:
  `IllegalArgumentException` - if the response is `null`

### Method Detail

#### addProperty

    public void addProperty(String key,
                            String value)

The default behavior of this method is to call `addProperty(key, value)` on the wrapped response object.

Specified by:
  `addProperty` in interface `PortletResponse`
Parameters:
  `key` - the key of the property to be returned to the portal
  `value` - the value of the property to be returned to the portal

#### encodeURL

    public String encodeURL(String path)

The default behavior of this method is to call `encodeURL(path)` on the wrapped response object.

Specified by:
  `encodeURL` in interface `PortletResponse`
Parameters:
  `path` - the URI path to the resource. This must be either an absolute URL (e.g. `http://my.co/myportal/mywebap/myfolder/myresource.gif`) or a full path URI (e.g. `/myportal/mywebap/myfolder/myresource.gif`).
Returns:
  the encoded resource URL as string, may not be a valid URL

#### getNamespace

    public String getNamespace()

The default behavior of this method is to call `getNamespace()` on the wrapped response object.

Specified by:
  `getNamespace` in interface `PortletResponse`
Returns:
  the namespace

#### setProperty

    public void setProperty(String key,
                            String value)

The default behavior of this method is to call `setProperty(key, value)` on the wrapped response object.

Specified by:
  `setProperty` in interface `PortletResponse`
Parameters:
  `key` - the key of the property to be returned to the portal
  `value` - the value of the property to be returned to the portal

#### getResponse

    public PortletResponse getResponse()

Return the wrapped response object.

Returns:
  the wrapped response

#### setResponse

    public void setResponse(PortletResponse response)

Sets the response object being wrapped.

Parameters:
  `response` - the response to set
Throws:
  `IllegalArgumentException` - if the response is null.

#### addProperty

    public void addProperty(String key,
                            Element element)

The default behavior of this method is to call `addProperty()` on the wrapped response object.

Specified by:
  `addProperty` in interface `PortletResponse`
Parameters:
  `key` - the key of the property to be returned to the portal
  `element` - the XML DOM element to be added to the response

#### createElement

    public Element createElement(String tagName)

The default behavior of this method is to call `createElement()` on the wrapped response object.

Specified by:
  `createElement` in interface `PortletResponse`
Parameters:
  `tagName` - name of the element type to instantiate
Returns:
  A new Element object with the nodeName attribute set to tagName, and localName, prefix, and namespaceURI set to null.

#### addProperty

    public void addProperty(javax.servlet.http.Cookie cookie)

The default behavior of this method is to call `addProperty()` on the wrapped response object.

Specified by:
  `addProperty` in interface `PortletResponse`
Parameters:
  `cookie` - the cookie to be added to the response