public class StateAwareResponseWrapper extends PortletResponseWrapper implements StateAwareResponse
StateAwareResponseWrapper
provides a convenient
implementation of the StateAwareResponse
interface
that can be subclassed by developers.
This class implements the Wrapper or Decorator pattern.
Methods default to calling through to the wrapped Response object.
Constructor and Description |
---|
StateAwareResponseWrapper(StateAwareResponse response) |
Modifier and Type | Method and Description |
---|---|
PortletMode |
getPortletMode()
Returns the current portlet mode of the portlet.
|
Map<String,String[]> |
getRenderParameterMap()
Deprecated.
|
MutableRenderParameters |
getRenderParameters()
Gets the mutable render parameters.
|
StateAwareResponse |
getResponse()
Return the wrapped response object.
|
WindowState |
getWindowState()
Returns the current window state of the portlet.
|
void |
removePublicRenderParameter(String name)
Deprecated.
|
void |
setEvent(QName name,
Serializable value)
Publishes an Event with the given payload.
|
void |
setEvent(String name,
Serializable value)
Publishes an Event with the given payload in the default namespace.
|
void |
setPortletMode(PortletMode portletMode)
Sets the portlet mode of a portlet to the given portlet mode.
|
void |
setRenderParameter(String key,
String... values)
Deprecated.
|
void |
setRenderParameter(String key,
String value)
Deprecated.
|
void |
setRenderParameters(Map<String,String[]> parameters)
Deprecated.
|
void |
setResponse(StateAwareResponse response)
Sets the response object being wrapped.
|
void |
setWindowState(WindowState windowState)
Sets the window state of a portlet to the given window state.
|
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty, setResponse
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty
public StateAwareResponseWrapper(StateAwareResponse response)
response
- public StateAwareResponse getResponse()
getResponse
in class PortletResponseWrapper
public void setResponse(StateAwareResponse response)
response
- the response to setIllegalArgumentException
- if the response is null.public MutableRenderParameters getRenderParameters()
MutableRenderState
getRenderParameters
in interface MutableRenderState
getRenderParameters
in interface RenderState
MutableRenderParameters
object representing
the private and public render parametersPortletParameters
,
RenderParameters
,
MutablePortletParameters
,
MutableRenderParameters
public void setWindowState(WindowState windowState) throws WindowStateException
MutableRenderState
Possible values are the standard window states and any custom window states supported by the portal and the portlet. Standard window states are:
Not more than one window state can be set. If more than one window state is set, only the last one set is valid.
setWindowState
in interface MutableRenderState
windowState
- the new portlet window stateWindowStateException
- if the portlet cannot switch to this state,
because the portal does not support this state, the portlet has not
declared in its deployment descriptor that it supports this state, or the current
user is not allowed to switch to this state.
The PortletRequest.isWindowStateAllowed()
method can be used
to check if the portlet can set a given window state.public void setPortletMode(PortletMode portletMode) throws PortletModeException
MutableRenderState
Possible values are the standard portlet modes and any custom portlet modes supported by the portal and the portlet. Portlets must declare in the deployment descriptor the portlet modes they support for each markup type. Standard portlet modes are:
Not more than one portlet mode can be set. If more than one portlet mode is set, only the last one set is valid.
Note: The portlet may still be called in a different portlet mode in the next render call, depending on the portlet container / portal.
setPortletMode
in interface MutableRenderState
portletMode
- the new portlet modePortletModeException
- if the portlet cannot switch to this mode,
because the portal does not support this mode, the portlet has not
declared in its deployment descriptor that it supports this mode for the current markup,
or the current user is not allowed to switch to this mode.
The PortletRequest.isPortletModeAllowed()
method can be used
to check if the portlet can set a given portlet mode.public PortletMode getPortletMode()
RenderState
getPortletMode
in interface RenderState
PortletMode.UNDEFINED
is returned.PortletMode
public WindowState getWindowState()
RenderState
getWindowState
in interface RenderState
WindowState.UNDEFINED
is returned.WindowState
@Deprecated public void setRenderParameters(Map<String,String[]> parameters)
StateAwareResponse
These parameters will be accessible in all sub-sequent render calls via
the PortletRequest.getParameter
call until a new request
is targeted to the portlet.
The given parameters do not need to be encoded prior to calling this method.
The portlet should not modify the map any further after calling this method.
This method can be used to set both public and private render parameters.
These parameters will be accessible in all subsequent render calls via the PortletRequest.getParameter call until a new request is targeted to the portlet.
Any previously set private render parameter that is not contained in the new map is removed. However, public render parameters cannot be removed by excluding them from the map. Public render parameters that are not included in the map remain unchanged.
The given parameters do not need to be encoded prior to calling this method.
The portlet should not modify the map any further after calling this method.
setRenderParameters
in interface StateAwareResponse
parameters
-
Map containing parameter names for the render phase as keys and
parameter values as map values. The keys in the parameter map must be of type
String and may not be null or the empty string (""). The values in the parameter
map must be of type String array (String[]
).
The values array may not be null;
however, the values array elements may be null.
@Deprecated public void setRenderParameter(String key, String value)
StateAwareResponse
These parameters will be accessible in all subsequent render calls until an action or render request is targeted to the portlet.
This method replaces all parameters with the given key.
The given parameter do not need to be encoded prior to calling this method.
A parameter value of null
indicates that this
parameter should be removed.
However, an empty string value ("") is allowed.
setRenderParameter
in interface StateAwareResponse
key
- key of the render parametervalue
- value of the render parameter@Deprecated public void setRenderParameter(String key, String... values)
StateAwareResponse
These parameters will be accessible in all subsequent render calls until an action or render request is targeted to the portlet.
This method replaces all parameter values with the given key.
The given parameter do not need to be encoded prior to calling this method.
A values parameter of null
indicates that this
parameter should be removed.
If the values parameter is not null, elements of the array may be null.
setRenderParameter
in interface StateAwareResponse
key
- key of the render parametervalues
- values of the render parameterpublic void setEvent(QName name, Serializable value)
StateAwareResponse
The object type of the value must be compliant with the specified event type in the portlet deployment descriptor.
The value must have a valid JAXB binding and be serializable.
setEvent
in interface StateAwareResponse
name
- the event name to publish, must not be null
value
- the value of this event, must have a valid JAXB binding and
be serializable, or null
.public void setEvent(String name, Serializable value)
StateAwareResponse
The name is treated as local part of the event QName and the namespace
is either taken from the default-event-namespace
element
in the portlet deployment descriptor, or if this element is not provided
the XML default namespace XMLConstants.NULL_NS_URI is used.
The object type of the value must be compliant with the specified event type in the portlet deployment descriptor.
The value must have a valid JAXB binding and be serializable.
setEvent
in interface StateAwareResponse
name
- the local part of the event name to publish, must not be null
value
- the value of this event, must have a valid JAXB binding and
be serializable, or null
.@Deprecated public Map<String,String[]> getRenderParameterMap()
StateAwareResponse
Map
of the render parameters currently set on
this response.
The values in the returned Map
are of type String array (String[]
).
The contents of the returned map are immutable in the sense that modifying the map does not directly
affect the render parameters. In order to set the parameters using the modified map,
the StateAwareResponse.setRenderParameters(Map)
method must be used.
If no parameters exist this method returns an empty Map
.
getRenderParameterMap
in interface StateAwareResponse
Map
containing render parameter names as keys and
parameter values as map values, or an empty Map
if
no parameters exist. The keys in the parameter map are of type
String. The values in the parameter map are of type String array (String[]
).@Deprecated public void removePublicRenderParameter(String name)
StateAwareResponse
public-render-parameter
element with the
identifier
mapping to the parameter name.removePublicRenderParameter
in interface StateAwareResponse
name
- a String
specifying
the name of the public render parameter to be removedJava Portlet 3.0 API Specification. See the Copyright and License provided with this distribution. Use is subject to license terms.