Top Description Constructors Methods
javax.portlet.filter

public Class ActionResponseWrapper

extends StateAwareResponseWrapper
implements ActionResponse
Class Inheritance
All Implemented Interfaces
javax.portlet.ActionResponse, javax.portlet.StateAwareResponse, javax.portlet.MutableRenderState, javax.portlet.Mutable, javax.portlet.RenderState, javax.portlet.PortletResponse
Imports
java.io.IOException, javax.portlet.ActionResponse, .MimeResponse.Copy, .RenderURL

The ActionResponseWrapper provides a convenient implementation of the ActionResponse 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.
Since
2.0
See Also
ActionResponse

Constructor Summary

AccessConstructor and Description
public
ActionResponseWrapper(ActionResponse
the action response to wrap
response
)

Creates an ActionResponse adaptor wrapping the given response object.

Method Summary

Modifier and TypeMethod and Description
public RenderURL
createRedirectURL(MimeResponse.Copy
Specifies how current parameters are to be copied to the URL
option
)

Implements javax.portlet.ActionResponse.createRedirectURL.

Returns a render URL containing render parameters according to the MimeResponse.Copy argument.
public ActionResponse

Returns:

the wrapped response
getResponse
()

Overrides javax.portlet.filter.StateAwareResponseWrapper.getResponse.

Return the wrapped response object.
public void
sendRedirect(String
the redirect location URL
location
)

Implements javax.portlet.ActionResponse.sendRedirect.

Instructs the portlet container to send a redirect response to the client using the specified redirect location URL.
public void
sendRedirect(String
the redirect location URL
location
,
String
name of the query parameter under which the portlet container should store a render URL to this portlet
renderUrlParamName
)

Implements javax.portlet.ActionResponse.sendRedirect.

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.
public void
setResponse(ActionResponse
the response to set
response
)

Sets the response object being wrapped.

Inherited from javax.portlet.filter.StateAwareResponseWrapper:
getPortletModegetRenderParameterMapgetRenderParametersgetWindowStateremovePublicRenderParametersetEventsetEventsetPortletModesetRenderParametersetRenderParametersetRenderParameterssetResponsesetWindowState

Constructor Detail

ActionResponseWrapperback to summary
public ActionResponseWrapper(ActionResponse response)

Creates an ActionResponse adaptor wrapping the given response object.

Parameters
response:ActionResponse

the action response to wrap

Exceptions
IllegalArgumentException:
if the response is null

Method Detail

createRedirectURLback to summary
public RenderURL createRedirectURL(MimeResponse.Copy option) throws IllegalStateException

Implements javax.portlet.ActionResponse.createRedirectURL.

Doc from javax.portlet.ActionResponse.createRedirectURL.

Returns 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 option parameter.

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.
The URL can be further extended by adding render parameters, portlet mode, and window state. If no additional portlet mode, window state or security modifier is set on the URL, the values from the current render or resource request are preserved.

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.

Parameters
option:MimeResponse.Copy

Specifies how current parameters are to be copied to the URL

Returns:RenderURL

a portlet render URL

Annotations
@Override
Exceptions
IllegalStateException:
if the method is invoked after any of above mentioned methods of the ActionResponse interface has been called.
getResponseback to summary
public ActionResponse getResponse()

Overrides javax.portlet.filter.StateAwareResponseWrapper.getResponse.

Return the wrapped response object.

Returns:ActionResponse

the wrapped response

sendRedirectback to summary
public void sendRedirect(String location) throws IOException

Implements javax.portlet.ActionResponse.sendRedirect.

Doc from javax.portlet.ActionResponse.sendRedirect.

Instructs 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
Parameters
location:String

the redirect location URL

Annotations
@Override
Exceptions
IOException:
if an input or output exception occurs.
sendRedirectback to summary
public void sendRedirect(String location, String renderUrlParamName) throws IOException

Implements javax.portlet.ActionResponse.sendRedirect.

Doc from javax.portlet.ActionResponse.sendRedirect.

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.

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 ActionResponse and the current public render parameters. The attached URL will be available as query parameter value under the key provided with the renderUrlParamName parameter.

New values for

  • setPortletMode
  • setWindowState
  • setRenderParameter
  • setRenderParameters
  • getRenderParameters
are only used for creating the render URL and not remembered after the redirect is issued.
Parameters
location:String

the redirect location URL

renderUrlParamName:String

name of the query parameter under which the portlet container should store a render URL to this portlet

Annotations
@Override
Exceptions
IOException:
if an input or output exception occurs.
setResponseback to summary
public void setResponse(ActionResponse response)

Sets the response object being wrapped.

Parameters
response:ActionResponse

the response to set

Exceptions
IllegalArgumentException:
if the response is null.