public class ActionResponseWrapper extends StateAwareResponseWrapper implements ActionResponse
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.ActionResponse
Constructor and Description |
---|
ActionResponseWrapper(ActionResponse response)
Creates an
ActionResponse adaptor
wrapping the given response object. |
Modifier and Type | Method and Description |
---|---|
RenderURL |
createRedirectURL(MimeResponse.Copy option)
Returns a render URL containing render parameters according to the
MimeResponse.Copy argument.
|
ActionResponse |
getResponse()
Return the wrapped response object.
|
void |
sendRedirect(String location)
Instructs the portlet container to send a redirect response
to the client using the specified redirect location URL.
|
void |
sendRedirect(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.
|
void |
setResponse(ActionResponse response)
Sets the response object being wrapped.
|
getPortletMode, getRenderParameterMap, getRenderParameters, getWindowState, removePublicRenderParameter, setEvent, setEvent, setPortletMode, setRenderParameter, setRenderParameter, setRenderParameters, setResponse, setWindowState
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty, setResponse
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRenderParameterMap, removePublicRenderParameter, setEvent, setEvent, setRenderParameter, setRenderParameter, setRenderParameters
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty
getRenderParameters, setPortletMode, setWindowState
getPortletMode, getWindowState
public ActionResponseWrapper(ActionResponse response)
ActionResponse
adaptor
wrapping the given response object.response
- the action response to wrapIllegalArgumentException
- if the response is null
public ActionResponse getResponse()
getResponse
in class StateAwareResponseWrapper
public void setResponse(ActionResponse response)
response
- the response to setIllegalArgumentException
- if the response is null.public void sendRedirect(String location) throws IOException
ActionResponse
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:
sendRedirect
in interface ActionResponse
location
- the redirect location URLIOException
- if an input or output exception occurs.public void sendRedirect(String location, String renderUrlParamName) throws IOException
ActionResponse
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
sendRedirect
in interface ActionResponse
location
- the redirect location URLrenderUrlParamName
- name of the query parameter under which the portlet container should
store a render URL to this portletIOException
- if an input or output exception occurs.public RenderURL createRedirectURL(MimeResponse.Copy option) throws IllegalStateException
ActionResponse
The createRedirectURL method cannot be invoked after any of the following methods of the ActionResponse interface has been called:
The new render URL will contain render parameters from the
current request as specified by the option
parameter.
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.
createRedirectURL
in interface ActionResponse
option
- Specifies how current parameters are to be copied to the URLIllegalStateException
- if the method is invoked after any of above mentioned methods of
the ActionResponse interface has been called.MimeResponse.Copy
Java Portlet 3.0 API Specification. See the Copyright and License provided with this distribution. Use is subject to license terms.