public class PortletResponseWrapper extends Object implements PortletResponse
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.PortletResponse
Constructor and Description |
---|
PortletResponseWrapper(PortletResponse response)
Creates an
ActionResponse adaptor wrapping the given response object. |
Modifier and Type | Method and Description |
---|---|
void |
addProperty(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. |
String |
getProperty(String key)
Gets the value of the response property with the given name.
|
Collection<String> |
getPropertyNames()
Gets the names of all response properties set on the response.
|
Collection<String> |
getPropertyValues(String name)
Gets the values of the response property with the given name.
|
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.
|
public PortletResponseWrapper(PortletResponse response)
ActionResponse
adaptor wrapping the given response object.response
- the action response to wrapIllegalArgumentException
- if the response is null
public void addProperty(String key, String value)
addProperty(key, value)
on the wrapped response
object.addProperty
in interface PortletResponse
key
- the key of the property to be returned to the portalvalue
- the value of the property to be returned to the portal.
The value should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt).
public String encodeURL(String path)
encodeURL(path)
on the wrapped response object.encodeURL
in interface PortletResponse
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
).public String getNamespace()
getNamespace()
on the wrapped response object.getNamespace
in interface PortletResponse
public void setProperty(String key, String value)
setProperty(key, value)
on the wrapped response
object.setProperty
in interface PortletResponse
key
- the key of the property to be returned to the portalvalue
- the value of the property to be returned to the portal.
The value should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt).
public PortletResponse getResponse()
public void setResponse(PortletResponse response)
response
- the response to setIllegalArgumentException
- if the response is null.public void addProperty(String key, Element element)
addProperty()
on the wrapped response object.addProperty
in interface PortletResponse
key
- the key of the property to be returned to the portalelement
- the XML DOM element to be added to the responsepublic Element createElement(String tagName)
createElement()
on the wrapped response object.createElement
in interface PortletResponse
tagName
- name of the element type to instantiatepublic void addProperty(Cookie cookie)
addProperty()
on the wrapped response object.addProperty
in interface PortletResponse
cookie
- the cookie to be added to the responsepublic String getProperty(String key)
PortletResponse
If a response property with the given name exists and contains multiple values, the value that was added first will be returned.
This method considers only response properties set or added via
setProperty(java.lang.String, java.lang.String)
or
addProperty(java.lang.String, java.lang.String)
.
getProperty
in interface PortletResponse
key
- the name of the response property whose value is to be returnedpublic Collection<String> getPropertyValues(String name)
PortletResponse
This method considers only response properties set or added via
setProperty(java.lang.String, java.lang.String)
or
addProperty(java.lang.String, java.lang.String)
.
Altering the returned collection will not affect the properties set on the response.
getPropertyValues
in interface PortletResponse
name
- the name of the response property whose values are to be returnedpublic Collection<String> getPropertyNames()
PortletResponse
This method considers only response properties set or added via
setProperty(java.lang.String, java.lang.String)
or
addProperty(java.lang.String, java.lang.String)
.
Altering the returned collection will not affect the properties set on the response.
getPropertyNames
in interface PortletResponse
Java Portlet 3.0 API Specification. See the Copyright and License provided with this distribution. Use is subject to license terms.