Class StateAwareResponseWrapper
- java.lang.Object
-
- jakarta.portlet.filter.PortletResponseWrapper
-
- jakarta.portlet.filter.StateAwareResponseWrapper
-
- All Implemented Interfaces:
Mutable,MutableRenderState,PortletResponse,RenderState,StateAwareResponse
- Direct Known Subclasses:
ActionResponseWrapper,EventResponseWrapper
public class StateAwareResponseWrapper extends PortletResponseWrapper implements StateAwareResponse
TheStateAwareResponseWrapperprovides a convenient implementation of theStateAwareResponseinterface that can be subclassed by developers. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped Response object.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description StateAwareResponseWrapper(StateAwareResponse response)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PortletModegetPortletMode()Returns the current portlet mode of the portlet.Map<String,String[]>getRenderParameterMap()Deprecated.MutableRenderParametersgetRenderParameters()Gets the mutable render parameters.StateAwareResponsegetResponse()Return the wrapped response object.WindowStategetWindowState()Returns the current window state of the portlet.voidremovePublicRenderParameter(String name)Deprecated.voidsetEvent(String name, Serializable value)Publishes an Event with the given payload in the default namespace.voidsetEvent(QName name, Serializable value)Publishes an Event with the given payload.voidsetPortletMode(PortletMode portletMode)Sets the portlet mode of a portlet to the given portlet mode.voidsetRenderParameter(String key, String value)Deprecated.voidsetRenderParameter(String key, String... values)Deprecated.voidsetRenderParameters(Map<String,String[]> parameters)Deprecated.voidsetResponse(StateAwareResponse response)Sets the response object being wrapped.voidsetWindowState(WindowState windowState)Sets the window state of a portlet to the given window state.-
Methods inherited from class jakarta.portlet.filter.PortletResponseWrapper
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty, setResponse
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.portlet.PortletResponse
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty
-
-
-
-
Constructor Detail
-
StateAwareResponseWrapper
public StateAwareResponseWrapper(StateAwareResponse response)
- Parameters:
response- the wrapped response
-
-
Method Detail
-
getResponse
public StateAwareResponse getResponse()
Return the wrapped response object.- Overrides:
getResponsein classPortletResponseWrapper- Returns:
- the wrapped response
-
setResponse
public void setResponse(StateAwareResponse response)
Sets the response object being wrapped.- Parameters:
response- the response to set- Throws:
IllegalArgumentException- if the response is null.
-
getRenderParameters
public MutableRenderParameters getRenderParameters()
Description copied from interface:MutableRenderStateGets the mutable render parameters.- Specified by:
getRenderParametersin interfaceMutableRenderState- Specified by:
getRenderParametersin interfaceRenderState- Returns:
- a
MutableRenderParametersobject representing the private and public render parameters - See Also:
PortletParameters,RenderParameters,MutablePortletParameters,MutableRenderParameters
-
setWindowState
public void setWindowState(WindowState windowState) throws WindowStateException
Description copied from interface:MutableRenderStateSets the window state of a portlet to the given window state.Possible values are the standard window states and any custom window states supported by the portal and the portlet. Standard window states are:
- MINIMIZED
- NORMAL
- MAXIMIZED
Not more than one window state can be set. If more than one window state is set, only the last one set is valid.
- Specified by:
setWindowStatein interfaceMutableRenderState- Parameters:
windowState- the new portlet window state- Throws:
WindowStateException- 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. ThePortletRequest.isWindowStateAllowed()method can be used to check if the portlet can set a given window state.
-
setPortletMode
public void setPortletMode(PortletMode portletMode) throws PortletModeException
Description copied from interface:MutableRenderStateSets the portlet mode of a portlet to the given portlet mode.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:
- EDIT
- HELP
- VIEW
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.
- Specified by:
setPortletModein interfaceMutableRenderState- Parameters:
portletMode- the new portlet mode- Throws:
PortletModeException- 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. ThePortletRequest.isPortletModeAllowed()method can be used to check if the portlet can set a given portlet mode.
-
getPortletMode
public PortletMode getPortletMode()
Description copied from interface:RenderStateReturns the current portlet mode of the portlet.- Specified by:
getPortletModein interfaceRenderState- Returns:
- the portlet mode. If the portlet mode is not available,
PortletMode.UNDEFINEDis returned. - See Also:
PortletMode
-
getWindowState
public WindowState getWindowState()
Description copied from interface:RenderStateReturns the current window state of the portlet.- Specified by:
getWindowStatein interfaceRenderState- Returns:
- the window state. If the window state is not available,
WindowState.UNDEFINEDis returned. - See Also:
WindowState
-
setRenderParameters
@Deprecated public void setRenderParameters(Map<String,String[]> parameters)
Deprecated.Description copied from interface:StateAwareResponseSets a parameter map for the render request.These parameters will be accessible in all sub-sequent render calls via the
PortletRequest.getParametercall 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.
- Specified by:
setRenderParametersin interfaceStateAwareResponse- Parameters:
parameters- the render 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.
-
setRenderParameter
@Deprecated public void setRenderParameter(String key, String value)
Deprecated.Description copied from interface:StateAwareResponseSets a String parameter for the render request.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
nullindicates that this parameter should be removed. However, an empty string value ("") is allowed.- Specified by:
setRenderParameterin interfaceStateAwareResponse- Parameters:
key- key of the render parametervalue- value of the render parameter
-
setRenderParameter
@Deprecated public void setRenderParameter(String key, String... values)
Deprecated.Description copied from interface:StateAwareResponseSets a multi-valued String parameter for the render request.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
nullindicates that this parameter should be removed.If the values parameter is not null, elements of the array may be null.
- Specified by:
setRenderParameterin interfaceStateAwareResponse- Parameters:
key- key of the render parametervalues- values of the render parameter
-
setEvent
public void setEvent(QName name, Serializable value)
Description copied from interface:StateAwareResponsePublishes an Event with the given payload.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.
- Specified by:
setEventin interfaceStateAwareResponse- Parameters:
name- the event name to publish, must not benullvalue- the value of this event, must have a valid JAXB binding and be serializable, ornull.
-
setEvent
public void setEvent(String name, Serializable value)
Description copied from interface:StateAwareResponsePublishes an Event with the given payload in the default namespace.The name is treated as local part of the event QName and the namespace is either taken from the
default-event-namespaceelement 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.
- Specified by:
setEventin interfaceStateAwareResponse- Parameters:
name- the local part of the event name to publish, must not benullvalue- the value of this event, must have a valid JAXB binding and be serializable, ornull.
-
getRenderParameterMap
@Deprecated public Map<String,String[]> getRenderParameterMap()
Deprecated.Description copied from interface:StateAwareResponseReturns aMapof the render parameters currently set on this response.The values in the returned
Mapare 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.- Specified by:
getRenderParameterMapin interfaceStateAwareResponse- Returns:
Mapcontaining render parameter names as keys and parameter values as map values, or an emptyMapif 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[]).
-
removePublicRenderParameter
@Deprecated public void removePublicRenderParameter(String name)
Deprecated.Description copied from interface:StateAwareResponseRemoves the specified public render parameter. The name must reference a public render parameter defined in the portlet deployment descriptor under thepublic-render-parameterelement with theidentifiermapping to the parameter name.- Specified by:
removePublicRenderParameterin interfaceStateAwareResponse- Parameters:
name- aStringspecifying the name of the public render parameter to be removed
-
-