Package 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 java.lang.Object implements PortletResponse
ThePortletResponseWrapper
provides a convenient implementation of thePortletResponse
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 Description PortletResponseWrapper(PortletResponse response)
Creates anActionResponse
adaptor wrapping the given response object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProperty(java.lang.String key, java.lang.String value)
The default behavior of this method is to calladdProperty(key, value)
on the wrapped response object.void
addProperty(java.lang.String key, org.w3c.dom.Element element)
The default behavior of this method is to calladdProperty()
on the wrapped response object.void
addProperty(javax.servlet.http.Cookie cookie)
The default behavior of this method is to calladdProperty()
on the wrapped response object.org.w3c.dom.Element
createElement(java.lang.String tagName)
The default behavior of this method is to callcreateElement()
on the wrapped response object.java.lang.String
encodeURL(java.lang.String path)
The default behavior of this method is to callencodeURL(path)
on the wrapped response object.java.lang.String
getNamespace()
The default behavior of this method is to callgetNamespace()
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 callsetProperty(key, value)
on the wrapped response object.void
setResponse(PortletResponse response)
Sets the response object being wrapped.
-
-
-
Constructor Detail
-
PortletResponseWrapper
public PortletResponseWrapper(PortletResponse response)
Creates anActionResponse
adaptor wrapping the given response object.- Parameters:
response
- the action response to wrap- Throws:
java.lang.IllegalArgumentException
- if the response isnull
-
-
Method Detail
-
addProperty
public void addProperty(java.lang.String key, java.lang.String value)
The default behavior of this method is to calladdProperty(key, value)
on the wrapped response object.- Specified by:
addProperty
in interfacePortletResponse
- Parameters:
key
- the key of the property to be returned to the portalvalue
- 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 callencodeURL(path)
on the wrapped response object.- Specified by:
encodeURL
in interfacePortletResponse
- 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 callgetNamespace()
on the wrapped response object.- Specified by:
getNamespace
in interfacePortletResponse
- Returns:
- the namespace
-
setProperty
public void setProperty(java.lang.String key, java.lang.String value)
The default behavior of this method is to callsetProperty(key, value)
on the wrapped response object.- Specified by:
setProperty
in interfacePortletResponse
- Parameters:
key
- the key of the property to be returned to the portalvalue
- 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 calladdProperty()
on the wrapped response object.- Specified by:
addProperty
in interfacePortletResponse
- Parameters:
key
- the key of the property to be returned to the portalelement
- 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 callcreateElement()
on the wrapped response object.- Specified by:
createElement
in interfacePortletResponse
- 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 calladdProperty()
on the wrapped response object.- Specified by:
addProperty
in interfacePortletResponse
- Parameters:
cookie
- the cookie to be added to the response
-
-