Class ActionResponseWrapper
- java.lang.Object
-
- jakarta.portlet.filter.PortletResponseWrapper
-
- jakarta.portlet.filter.StateAwareResponseWrapper
-
- jakarta.portlet.filter.ActionResponseWrapper
-
- All Implemented Interfaces:
ActionResponse,Mutable,MutableRenderState,PortletResponse,RenderState,StateAwareResponse
public class ActionResponseWrapper extends StateAwareResponseWrapper implements ActionResponse
TheActionResponseWrapperprovides a convenient implementation of theActionResponseinterface 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:
- 2.0
- See Also:
ActionResponse
-
-
Constructor Summary
Constructors Constructor Description ActionResponseWrapper(ActionResponse response)Creates anActionResponseadaptor wrapping the given response object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RenderURLcreateRedirectURL(MimeResponse.Copy option)Returns a render URL containing render parameters according to the MimeResponse.Copy argument.ActionResponsegetResponse()Return the wrapped response object.voidsendRedirect(String location)Instructs the portlet container to send a redirect response to the client using the specified redirect location URL.voidsendRedirect(String location, String renderUrlParamName)Instructs the portlet container to send a redirect response to the client using the specified redirect location URL and encode a render URL as parameter on the redirect URL.voidsetResponse(ActionResponse response)Sets the response object being wrapped.-
Methods inherited from class jakarta.portlet.filter.StateAwareResponseWrapper
getPortletMode, getRenderParameterMap, getRenderParameters, getWindowState, removePublicRenderParameter, setEvent, setEvent, setPortletMode, setRenderParameter, setRenderParameter, setRenderParameters, setResponse, setWindowState
-
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.MutableRenderState
getRenderParameters, setPortletMode, setWindowState
-
Methods inherited from interface jakarta.portlet.PortletResponse
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty
-
Methods inherited from interface jakarta.portlet.RenderState
getPortletMode, getWindowState
-
Methods inherited from interface jakarta.portlet.StateAwareResponse
getRenderParameterMap, removePublicRenderParameter, setEvent, setEvent, setRenderParameter, setRenderParameter, setRenderParameters
-
-
-
-
Constructor Detail
-
ActionResponseWrapper
public ActionResponseWrapper(ActionResponse response)
Creates anActionResponseadaptor wrapping the given response object.- Parameters:
response- the action response to wrap- Throws:
IllegalArgumentException- if the response isnull
-
-
Method Detail
-
getResponse
public ActionResponse getResponse()
Return the wrapped response object.- Overrides:
getResponsein classStateAwareResponseWrapper- Returns:
- the wrapped response
-
setResponse
public void setResponse(ActionResponse response)
Sets the response object being wrapped.- Parameters:
response- the response to set- Throws:
IllegalArgumentException- if the response is null.
-
sendRedirect
public void sendRedirect(String location) throws IOException
Description copied from interface:ActionResponseInstructs the portlet container to send a redirect response to the client using the specified redirect location URL.This method only accepts 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). If required, the portlet container may encode the given URL before the redirection is issued to the client.The sendRedirect method cannot be invoked after any of the following methods of the ActionResponse interface has been called:
- setPortletMode
- setWindowState
- setRenderParameter
- setRenderParameters
- removePublicRenderParamter
- getRenderParameters
- Specified by:
sendRedirectin interfaceActionResponse- Parameters:
location- the redirect location URL- Throws:
IOException- if an input or output exception occurs.
-
sendRedirect
public void sendRedirect(String location, String renderUrlParamName) throws IOException
Description copied from interface:ActionResponseInstructs the portlet container to send a redirect response to the client using the specified redirect location URL and encode a render URL as parameter on the redirect URL.This method only accepts 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). If required, the portlet container may encode the given URL before the redirection is issued to the client.The portlet container will attach a render URL with the currently set portlet mode, window state and render parameters on the
ActionResponseand the current public render parameters. The attached URL will be available as query parameter value under the key provided with therenderUrlParamNameparameter.New values for
- setPortletMode
- setWindowState
- setRenderParameter
- setRenderParameters
- getRenderParameters
- Specified by:
sendRedirectin interfaceActionResponse- Parameters:
location- the redirect location URLrenderUrlParamName- name of the query parameter under which the portlet container should store a render URL to this portlet- Throws:
IOException- if an input or output exception occurs.
-
createRedirectURL
public RenderURL createRedirectURL(MimeResponse.Copy option) throws IllegalStateException
Description copied from interface:ActionResponseReturns a render URL containing render parameters according to the MimeResponse.Copy argument. The portlet may modify the returned render URL. The URL is intended to be used in the sendRedirect(String location) method to allow the portlet to force a redirect to the same page with modified render state. * Creates a render URL targeting the current portlet.The createRedirectURL method cannot be invoked after any of the following methods of the ActionResponse interface has been called:
- setPortletMode
- setWindowState
- setRenderParameter
- setRenderParameters
- removePublicRenderParameter
- getRenderParameters
The new render URL will contain render parameters from the current request as specified by the
optionparameter.- NONE
- All public and private parameters are removed from the URL.
- ALL
- The public and private parameters governing the current request are added to the URL.
- PUBLIC
- Only public parameters governing the current request are added to the URL.
If a public render parameter value is set or removed on a render URL, then the public render parameter will be set to the new value or removed when the URL is activated.
- Specified by:
createRedirectURLin interfaceActionResponse- Parameters:
option- Specifies how current parameters are to be copied to the URL- Returns:
- a portlet render URL
- Throws:
IllegalStateException- if the method is invoked after any of above mentioned methods of the ActionResponse interface has been called.- See Also:
MimeResponse.Copy
-
-