PortletResponse defines the base interface to assist a
portlet in creating and sending a response to the client. The portlet
container uses specialized versions of this interface when invoking a
portlet.
The portlet container creates these objects and passes them as arguments to
the portlet's processAction, processEvent, serveResource and render methods.
ActionResponse, RenderResponse, EventResponse, ResourceResponse
| Modifier and Type | Method and Description |
|---|---|
| public void | addProperty(String
the key of the property to be returned to the portal key, String 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).
value)Adds a String property to an existing key to be returned to the portal. |
| public void | addProperty(Cookie
the cookie to be added to the response cookie)Adds a HTTP Cookie property to the response. |
| public void | addProperty(String
the key of the property to be returned to the portal key, Element the XML DOM element to be added to the response element)Adds an XML DOM element property to the response. |
| public Element | Returns: A new Element object with the nodeName attribute set to tagName, and localName, prefix, and namespaceURI set to null.name of the element type to instantiate tagName)Creates an element of the type specified to be used in the
|
| public String | Returns: the encoded resource URL as string, may not be a valid URLthe URI path to the resource. This must be either an absolute
URL (e.g.
path)http://my.co/myportal/mywebap/myfolder/myresource.gif)
or a full path URI (e.g.
/myportal/mywebap/myfolder/myresource.gif).Returns the encoded URL of the resource, like servlets, JSPs, images and other static files, at the given path. |
| public String | Returns: the namespaceThe value returned by this method should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page. |
| public String | Returns: the value of the response property with the given name, or null if no property with the given name has been set on this responsethe name of the response property whose value is to be returned key)
Gets the value of the response property with the given name.
|
| public Collection | Returns: the names of the response properties with the given name, or an empty collection if no properties have been set on this response
Gets the names of all response properties set on the response.
|
| public Collection | Returns: the values of the response property with the given name, or an empty collection if no property with the given name has been set on this responsethe name of the response property whose values are to be returned key)
Gets the values of the response property with the given name.
|
| public void | setProperty(String
the key of the property to be returned to the portal key, String 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).
value)Sets a String property to be returned to the portal. |
| addProperty | back to summary |
|---|---|
| public void addProperty(String key, String value) Adds a String property to an existing key to be returned to the portal. If there are no property values already associated with the key, a new key is created. This method allows response properties to have multiple values. Response properties can be viewed as header values set for the portal application. If these header values are intended to be transmitted to the client they should be set before the response is committed.
| |
| addProperty | back to summary |
|---|---|
| public void addProperty(Cookie cookie) Adds a HTTP Cookie property to the response. This method allows response properties to have multiple cookies.
| |
| addProperty | back to summary |
|---|---|
| public void addProperty(String key, Element element) Adds an XML DOM element property to the response. If a DOM element with the provided key already exists the provided element will be stored in addition to the existing element under the same key.
If the element is Response XML DOM element properties can be viewed as additional response document sections set for the portal application. If these header values are intended to be transmitted to the client they should be set before the response is committed.
| |
| createElement | back to summary |
|---|---|
| public Element createElement(String tagName) throws DOMException Creates an element of the type specified to be used in the
| |
| encodeURL | back to summary |
|---|---|
| public String encodeURL(String path) Returns the encoded URL of the resource, like servlets, JSPs, images and other static files, at the given path. Portlets should encode all resource URLs pointing to resources in the portlet application via this method in order to ensure that they get served via the portal application. Some portal/portlet-container implementation may require those URLs to contain implementation specific data encoded in it. Because of that, portlets should use this method to create such URLs.
The Portlet developer should be aware that the returned URL might not be a well formed URL but a special token at the time the portlet is generating its content. Thus portlets should not add additional parameters on the resulting URL or expect to be able to parse the URL. As a result, the outcome of the encodeURL call may be different than calling encodeURL in the servlet world.
| |
| getNamespace | back to summary |
|---|---|
| public String getNamespace() The value returned by this method should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page. The namespace value must be constant for the lifetime of the portlet window.
| |
| getProperty | back to summary |
|---|---|
| public String getProperty(String key)
Gets the value of the response property with the given name.
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
| |
| getPropertyNames | back to summary |
|---|---|
| public Collection
Gets the names of all response properties set on the response.
This method considers only response properties set or added via
Altering the returned collection will not affect the properties set on the response.
| |
| getPropertyValues | back to summary |
|---|---|
| public Collection
Gets the values of the response property with the given name.
This method considers only response properties set or added via
Altering the returned collection will not affect the properties set on the response.
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(String key, String value) Sets a String property to be returned to the portal. Response properties can be viewed as header values set for the portal application. If these header values are intended to be transmitted to the client they should be set before the response is committed. This method resets all properties previously added with the same key.
| |