Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.portlet
Interface StateAwareResponse

All Superinterfaces
  PortletResponse

All Known Subinterfaces:
  ActionResponse, EventResponse, WindowActionResponse

All Known Implementing Classes:
  ActionResponseWrapper, EventResponseWrapper

    public interface StateAwareResponse

extends PortletResponse

The `StateAwareResponse` represents a response that can modify state information or send events.
It extends the PortletResponse interface.

Since:
  2.0
See Also
  `PortletResponse`

Method Summary
`PortletMode` | `getPortletMode()` Returns the currently set portlet mode on this reponse.
`Map<String,String[]>` | `getRenderParameterMap()` Returns a `Map` of the render parameters currently set on this response.
`WindowState` | `getWindowState()` Returns the currently set window state on this response.
`void` | `removePublicRenderParameter(String name)` Removes the specified public render parameter.
`void` | `setEvent(QName name, Serializable value)` Publishes an Event with the given payload.
`void` | `setEvent(String name, 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(String key, String value)` Sets a String parameter for the render request.
`void` | `setRenderParameter(String key, String[] values)` Sets a String array parameter for the render request.
`void` | `setRenderParameters(Map<String,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 interface javax.portlet.PortletResponse
`addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, setProperty`

Method Detail

### setWindowState

    void setWindowState(WindowState windowState)
                        throws WindowStateException

  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:

  - MINIMIZED
  - NORMAL
  - MAXIMIZED

  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()`.
    `IllegalStateException` - if the method is invoked after `sendRedirect` has been called.
  See Also
    `WindowState`

### setPortletMode

    void setPortletMode(PortletMode portletMode)
                        throws PortletModeException

  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:

  - EDIT
  - HELP
  - VIEW

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

  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()`.
    `IllegalStateException` - if the method is invoked after `sendRedirect` has been called.

### setRenderParameters

    void setRenderParameters(Map<String,String[]> parameters)

  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.

  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[]`).
  Throws
    `IllegalArgumentException` - if parameters is `null`, if any of the keys in the Map are `null`, if any of the keys is not a String, or if any of the values is not a String array.
    `IllegalStateException` - if the method is invoked after `sendRedirect` has been called.

### setRenderParameter

    void setRenderParameter(String key,
                            String value)

  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.

  Parameters
    `key` - key of the render parameter
    `value` - value of the render parameter
  Throws
    `IllegalArgumentException` - if key is `null`.
    `IllegalStateException` - if the method is invoked after `sendRedirect` has been called.

### setRenderParameter

    void setRenderParameter(String key,
                            String[] values)

  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.

  Parameters
    `key` - key of the render parameter
    `values` - values of the render parameter
  Throws
    `IllegalArgumentException` - if key or value are `null`.
    `IllegalStateException` - if the method is invoked after `sendRedirect` has been called.

### setEvent

    void setEvent(QName name,
                  Serializable value)

  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.

  Parameters
    `name` - 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`.
  Throws
    `IllegalArgumentException` - if name is `null`, the value is not serializable, the value does not have a valid JAXB binding, the object type of the value is not the same as specified in the portlet deployment descriptor for this event name.
  Since:
    2.0

### setEvent

    void setEvent(String name,
                  Serializable value)

  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.

  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`.
  Throws
    `IllegalArgumentException` - if name is `null`, the value is not serializable, the value does not have a valid JAXB binding, the object type of the value is not the same as specified in the portlet deployment descriptor for this event name.
  Since:
    2.0

### getRenderParameterMap

    Map<String,String[]> getRenderParameterMap()

  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`.

  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[]`).
  Since:
    2.0

### getPortletMode

    PortletMode getPortletMode()

  Returns the currently set portlet mode on this reponse.

  Returns
    the portlet mode, or `null` if none is set
  Since:
    2.0

### getWindowState

    WindowState getWindowState()

  Returns the currently set window state on this response.

  Returns
    the window state, or `null` if none is set
  Since:
    2.0

### removePublicRenderParameter

    void removePublicRenderParameter(String name)

  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.

  Parameters
    `name` - a `String` specifying the name of the public render parameter to be removed
  Throws
    `IllegalArgumentException` - if name is `null`.
  Since:
    2.0

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.