org.apache.pluto.wrappers
Class ActionResponseWrapper

java.lang.Object
  extended by javax.servlet.ServletResponseWrapper
      extended by javax.servlet.http.HttpServletResponseWrapper
          extended by org.apache.pluto.wrappers.PortletResponseWrapper
              extended by org.apache.pluto.wrappers.ActionResponseWrapper
All Implemented Interfaces:
ActionResponse, PortletResponse, StateAwareResponse, javax.servlet.http.HttpServletResponse, javax.servlet.ServletResponse

public class ActionResponseWrapper
extends PortletResponseWrapper
implements ActionResponse


Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
 
Constructor Summary
ActionResponseWrapper(ActionResponse actionResponse)
          Creates a ServletResponse adaptor wrapping the given response object.
 
Method Summary
 ActionResponse getActionResponse()
          Return the wrapped ServletResponse object.
 PortletMode getPortletMode()
          Returns the currently set portlet mode on this reponse.
 java.util.Map getRenderParameterMap()
          Returns a Map of the render parameters currently set on this response.
 StateAwareResponse getStateAwareResponse()
           
 WindowState getWindowState()
          Returns the currently set window state on this response.
 void removePublicRenderParameter(java.lang.String name)
          Removes the specified public render parameter.
 void sendRedirect(java.lang.String location)
          Instructs the portlet container to send a redirect response to the client using the specified redirect location URL.
 void sendRedirect(java.lang.String location, java.lang.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 setEvent(javax.xml.namespace.QName qname, java.io.Serializable value)
          Publishes an Event with the given payload.
 void setEvent(java.lang.String name, java.io.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(java.lang.String key, java.lang.String value)
          Sets a String parameter for the render request.
 void setRenderParameter(java.lang.String key, java.lang.String[] values)
          Sets a String array parameter for the render request.
 void setRenderParameters(java.util.Map<java.lang.String,java.lang.String[]> parameters)
          Sets a parameter map for the render request.
 void setWindowState(WindowState windowState)
          Sets the window state of a portlet to the given window state.
 
Methods inherited from class org.apache.pluto.wrappers.PortletResponseWrapper
addProperty, addProperty, createActionURL, createElement, createRenderURL, createResourceURL, encodeURL, getNamespace, getPortletResponse, setProperty, setResponse
 
Methods inherited from class javax.servlet.http.HttpServletResponseWrapper
addCookie, addDateHeader, addHeader, addIntHeader, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, sendError, sendError, setDateHeader, setHeader, setIntHeader, setStatus, setStatus
 
Methods inherited from class javax.servlet.ServletResponseWrapper
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getResponse, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentType, setLocale, setResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.portlet.PortletResponse
addProperty, addProperty, createElement, encodeURL, getNamespace, setProperty
 
Methods inherited from interface javax.servlet.ServletResponse
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentType, setLocale
 

Constructor Detail

ActionResponseWrapper

public ActionResponseWrapper(ActionResponse actionResponse)
Creates a ServletResponse adaptor wrapping the given response object.

Throws:
java.lang.IllegalArgumentException - if the response is null.
Method Detail

setWindowState

public void setWindowState(WindowState windowState)
                    throws WindowStateException
Description copied from interface: StateAwareResponse
Sets 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:

Specified by:
setWindowState in interface StateAwareResponse
Parameters:
windowState - the new portlet window state
Throws:
WindowStateException - if the portlet cannot switch to the specified window state. To avoid this exception the portlet can check the allowed window states with Request.isWindowStateAllowed().
See Also:
WindowState

setPortletMode

public void setPortletMode(PortletMode portletMode)
                    throws PortletModeException
Description copied from interface: StateAwareResponse
Sets 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:

Note: The portlet may still be called in a different window state in the next render call, depending on the portlet container / portal.

Specified by:
setPortletMode in interface StateAwareResponse
Parameters:
portletMode - the new portlet mode
Throws:
PortletModeException - if the portlet cannot switch to this portlet mode, because the portlet or portal does not support it for this markup, or the current user is not allowed to switch to this portlet mode. To avoid this exception the portlet can check the allowed portlet modes with Request.isPortletModeAllowed().

sendRedirect

public void sendRedirect(java.lang.String location)
                  throws java.io.IOException
Description copied from interface: ActionResponse
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 can not be invoked after any of the following methods of the ActionResponse interface has been called:

Specified by:
sendRedirect in interface ActionResponse
Specified by:
sendRedirect in interface javax.servlet.http.HttpServletResponse
Overrides:
sendRedirect in class javax.servlet.http.HttpServletResponseWrapper
Parameters:
location - the redirect location URL
Throws:
java.io.IOException - if an input or output exception occurs.

setRenderParameters

public void setRenderParameters(java.util.Map<java.lang.String,java.lang.String[]> parameters)
Description copied from interface: StateAwareResponse
Sets a parameter map for the render request.

All previously set render parameters are cleared.

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.

Specified by:
setRenderParameters in interface StateAwareResponse
Parameters:
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. The values in the parameter map must be of type String array (String[]).

setRenderParameter

public void setRenderParameter(java.lang.String key,
                               java.lang.String value)
Description copied from interface: StateAwareResponse
Sets a String parameter for the render request.

These parameters will be accessible in all sub-sequent render calls via the PortletRequest.getParameter call until a 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.

Specified by:
setRenderParameter in interface StateAwareResponse
Parameters:
key - key of the render parameter
value - value of the render parameter

setRenderParameter

public void setRenderParameter(java.lang.String key,
                               java.lang.String[] values)
Description copied from interface: StateAwareResponse
Sets a String array parameter for the render request.

These parameters will be accessible in all sub-sequent render calls via the PortletRequest.getParameter call until a 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.

Specified by:
setRenderParameter in interface StateAwareResponse
Parameters:
key - key of the render parameter
values - values of the render parameter

getActionResponse

public ActionResponse getActionResponse()
Return the wrapped ServletResponse object.


getStateAwareResponse

public StateAwareResponse getStateAwareResponse()

setEvent

public void setEvent(javax.xml.namespace.QName qname,
                     java.io.Serializable value)
Description copied from interface: StateAwareResponse
Publishes 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:
setEvent in interface StateAwareResponse
Parameters:
qname - 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.

getPortletMode

public PortletMode getPortletMode()
Description copied from interface: StateAwareResponse
Returns the currently set portlet mode on this reponse.

Specified by:
getPortletMode in interface StateAwareResponse
Returns:
the portlet mode, or null if none is set

getRenderParameterMap

public java.util.Map getRenderParameterMap()
Description copied from interface: StateAwareResponse
Returns a Map of the render parameters currently set on this response.

The values in the returned Map are from type String array (String[]).

If no parameters exist this method returns an empty Map.

Specified by:
getRenderParameterMap in interface StateAwareResponse
Returns:
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[]).

getWindowState

public WindowState getWindowState()
Description copied from interface: StateAwareResponse
Returns the currently set window state on this response.

Specified by:
getWindowState in interface StateAwareResponse
Returns:
the window state, or null if none is set

setEvent

public void setEvent(java.lang.String name,
                     java.io.Serializable value)
Description copied from interface: StateAwareResponse
Publishes 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-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.

Specified by:
setEvent in interface StateAwareResponse
Parameters:
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.

sendRedirect

public void sendRedirect(java.lang.String location,
                         java.lang.String renderUrlParamName)
                  throws java.io.IOException
Description copied from interface: ActionResponse
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

are only used for creating the render URL and not remembered after the redirect is issued.

Specified by:
sendRedirect in interface ActionResponse
Parameters:
location - the redirect location URL
renderUrlParamName - name of the query parameter under which the portlet container should store a render URL to this portlet
Throws:
java.io.IOException - if an input or output exception occurs.

removePublicRenderParameter

public void removePublicRenderParameter(java.lang.String name)
Description copied from interface: StateAwareResponse
Removes the specified public render parameter. The name must reference a public render parameter defined in the portlet deployment descriptor under the public-render-parameter element with the identifier mapping to the parameter name.

Specified by:
removePublicRenderParameter in interface StateAwareResponse
Parameters:
name - a String specifying the name of the public render parameter to be removed


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.