javax.portlet.filter
Class PortletResponseWrapper

java.lang.Object
  extended by javax.portlet.filter.PortletResponseWrapper
All Implemented Interfaces:
PortletResponse
Direct Known Subclasses:
ActionResponseWrapper, EventResponseWrapper, RenderResponseWrapper, ResourceResponseWrapper

public class PortletResponseWrapper
extends java.lang.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
PortletResponseWrapper(PortletResponse response)
          Creates an ActionResponse adaptor wrapping the given response object.
 
Method Summary
 void addProperty(javax.servlet.http.Cookie cookie)
          The default behavior of this method is to call addProperty() on the wrapped response object.
 void addProperty(java.lang.String key, org.w3c.dom.Element element)
          The default behavior of this method is to call addProperty() on the wrapped response object.
 void addProperty(java.lang.String key, java.lang.String value)
          The default behavior of this method is to call addProperty(key, value) on the wrapped response object.
 org.w3c.dom.Element createElement(java.lang.String tagName)
          The default behavior of this method is to call createElement() on the wrapped response object.
 java.lang.String encodeURL(java.lang.String path)
          The default behavior of this method is to call encodeURL(path) on the wrapped response object.
 java.lang.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(java.lang.String key, java.lang.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:
java.lang.IllegalArgumentException - if the response is null
Method Detail

addProperty

public void addProperty(java.lang.String key,
                        java.lang.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 java.lang.String encodeURL(java.lang.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 java.lang.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(java.lang.String key,
                        java.lang.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:
java.lang.IllegalArgumentException - if the response is null.

addProperty

public void addProperty(java.lang.String key,
                        org.w3c.dom.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 org.w3c.dom.Element createElement(java.lang.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