## org.springframework.mock.web.portlet
Class MockPortletRequest

    java.lang.Object
      org.springframework.mock.web.portlet.MockPortletRequest

All Implemented Interfaces:
  javax.portlet.PortletRequest

Direct Known Subclasses:
  MockActionRequest, MockRenderRequest

    public class MockPortletRequest

extends Object
implements javax.portlet.PortletRequest

Mock implementation of the `PortletRequest` interface.

Since:
  2.0
Author:
  John A. Lewis, Juergen Hoeller

Field Summary

Fields inherited from interface javax.portlet.PortletRequest
`BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH, USER_INFO`

Constructor Summary
`MockPortletRequest()` Create a new MockPortletRequest with a default `MockPortalContext` and a default `MockPortletContext`.
`MockPortletRequest(javax.portlet.PortalContext portalContext, javax.portlet.PortletContext portletContext)` Create a new MockPortletRequest.
`MockPortletRequest(javax.portlet.PortletContext portletContext)` Create a new MockPortletRequest with a default `MockPortalContext`.

Method Summary
`void` `addLocale(Locale locale)`
`void` `addParameter(String name, String value)`
`void` `addParameter(String name, String[] values)`
`void` `addPreferredLocale(Locale locale)`
`void` `addPreferredResponseContentType(String responseContentType)`
`void` `addProperty(String key, String value)` Add a single value for the specified property.
`void` `addResponseContentType(String responseContentType)`
`void` `addUserRole(String role)`
`protected void` `checkActive()` Check whether this request is still active (that is, not completed yet), throwing an IllegalStateException if not active anymore.
`void` `close()` Mark this request as completed.
`Object` `getAttribute(String name)`
`Enumeration` `getAttributeNames()`
`String` `getAuthType()`
`String` `getContextPath()`
`Locale` `getLocale()`
`Enumeration` `getLocales()`
`String` `getParameter(String name)`
`Map` `getParameterMap()`
`Enumeration` `getParameterNames()`
`String[]` `getParameterValues(String name)`
`javax.portlet.PortalContext` `getPortalContext()`
`javax.portlet.PortletMode` `getPortletMode()`
`javax.portlet.PortletSession` `getPortletSession()`
`javax.portlet.PortletSession` `getPortletSession(boolean create)`
`javax.portlet.PortletPreferences` `getPreferences()`
`Enumeration` `getProperties(String key)`
`String` `getProperty(String key)`
`Enumeration` `getPropertyNames()`
`String` `getRemoteUser()`
`String` `getRequestedSessionId()`
`String` `getResponseContentType()`
`Enumeration` `getResponseContentTypes()`
`String` `getScheme()`
`String` `getServerName()`
`int` `getServerPort()`
`Principal` `getUserPrincipal()`
`javax.portlet.WindowState` `getWindowState()`
`boolean` `isActive()` Return whether this request is still active (that is, not completed yet).
`boolean` `isPortletModeAllowed(javax.portlet.PortletMode portletMode)`
`boolean` `isRequestedSessionIdValid()`
`boolean` `isSecure()`
`boolean` `isUserInRole(String role)`
`boolean` `isWindowStateAllowed(javax.portlet.WindowState windowState)`
`void` `removeAttribute(String name)`
`void` `setAttribute(String name, Object value)`
`void` `setAuthType(String authType)`
`void` `setContextPath(String contextPath)`
`void` `setParameter(String key, String value)`
`void` `setParameter(String key, String[] values)`
`void` `setParameters(Map parameters)`
`void` `setPortletMode(javax.portlet.PortletMode portletMode)`
`void` `setPreferences(javax.portlet.PortletPreferences preferences)`
`void` `setProperty(String key, String value)` Set a single value for the specified property.
`void` `setRemoteUser(String remoteUser)`
`void` `setRequestedSessionIdValid(boolean requestedSessionIdValid)`
`void` `setScheme(String scheme)`
`void` `setSecure(boolean secure)`
`void` `setServerName(String serverName)`
`void` `setServerPort(int serverPort)`
`void` `setSession(javax.portlet.PortletSession session)`
`void` `setUserPrincipal(Principal userPrincipal)`
`void` `setWindowState(javax.portlet.WindowState windowState)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MockPortletRequest

    public MockPortletRequest()

  Create a new MockPortletRequest with a default `MockPortalContext` and a default `MockPortletContext`.

  See Also:
    `MockPortalContext`, `MockPortletContext`

### MockPortletRequest

    public MockPortletRequest(javax.portlet.PortletContext portletContext)

  Create a new MockPortletRequest with a default `MockPortalContext`.

  Parameters:
    `portletContext` - the PortletContext that the request runs in
  See Also:
    `MockPortalContext`

### MockPortletRequest

    public MockPortletRequest(javax.portlet.PortalContext portalContext,
                              javax.portlet.PortletContext portletContext)

  Create a new MockPortletRequest.

  Parameters:
    `portalContext` - the PortalContext that the request runs in
    `portletContext` - the PortletContext that the request runs in

Method Detail

### isActive

    public boolean isActive()

  Return whether this request is still active (that is, not completed yet).

### close

    public void close()

  Mark this request as completed.

### checkActive

    protected void checkActive()
                        throws IllegalStateException

  Check whether this request is still active (that is, not completed yet), throwing an IllegalStateException if not active anymore.

  Throws:
    `IllegalStateException`

### isWindowStateAllowed

    public boolean isWindowStateAllowed(javax.portlet.WindowState windowState)

  Specified by:
    `isWindowStateAllowed` in interface `javax.portlet.PortletRequest`

### isPortletModeAllowed

    public boolean isPortletModeAllowed(javax.portlet.PortletMode portletMode)

  Specified by:
    `isPortletModeAllowed` in interface `javax.portlet.PortletRequest`

### setPortletMode

    public void setPortletMode(javax.portlet.PortletMode portletMode)

### getPortletMode

    public javax.portlet.PortletMode getPortletMode()

  Specified by:
    `getPortletMode` in interface `javax.portlet.PortletRequest`

### setWindowState

    public void setWindowState(javax.portlet.WindowState windowState)

### getWindowState

    public javax.portlet.WindowState getWindowState()

  Specified by:
    `getWindowState` in interface `javax.portlet.PortletRequest`

### setPreferences

    public void setPreferences(javax.portlet.PortletPreferences preferences)

### getPreferences

    public javax.portlet.PortletPreferences getPreferences()

  Specified by:
    `getPreferences` in interface `javax.portlet.PortletRequest`

### setSession

    public void setSession(javax.portlet.PortletSession session)

### getPortletSession

    public javax.portlet.PortletSession getPortletSession()

  Specified by:
    `getPortletSession` in interface `javax.portlet.PortletRequest`

### getPortletSession

    public javax.portlet.PortletSession getPortletSession(boolean create)

  Specified by:
    `getPortletSession` in interface `javax.portlet.PortletRequest`

### setProperty

    public void setProperty(String key,
                            String value)

  Set a single value for the specified property.

  If there are already one or more values registered for the given property key, they will be replaced.

### addProperty

    public void addProperty(String key,
                            String value)

  Add a single value for the specified property.

  If there are already one or more values registered for the given property key, the given value will be added to the end of the list.

### getProperty

    public String getProperty(String key)

  Specified by:
    `getProperty` in interface `javax.portlet.PortletRequest`

### getProperties

    public Enumeration getProperties(String key)

  Specified by:
    `getProperties` in interface `javax.portlet.PortletRequest`

### getPropertyNames

    public Enumeration getPropertyNames()

  Specified by:
    `getPropertyNames` in interface `javax.portlet.PortletRequest`

### getPortalContext

    public javax.portlet.PortalContext getPortalContext()

  Specified by:
    `getPortalContext` in interface `javax.portlet.PortletRequest`

### setAuthType

    public void setAuthType(String authType)

### getAuthType

    public String getAuthType()

  Specified by:
    `getAuthType` in interface `javax.portlet.PortletRequest`

### setContextPath

    public void setContextPath(String contextPath)

### getContextPath

    public String getContextPath()

  Specified by:
    `getContextPath` in interface `javax.portlet.PortletRequest`

### setRemoteUser

    public void setRemoteUser(String remoteUser)

### getRemoteUser

    public String getRemoteUser()

  Specified by:
    `getRemoteUser` in interface `javax.portlet.PortletRequest`

### setUserPrincipal

    public void setUserPrincipal(Principal userPrincipal)

### getUserPrincipal

    public Principal getUserPrincipal()

  Specified by:
    `getUserPrincipal` in interface `javax.portlet.PortletRequest`

### addUserRole

    public void addUserRole(String role)

### isUserInRole

    public boolean isUserInRole(String role)

  Specified by:
    `isUserInRole` in interface `javax.portlet.PortletRequest`

### getAttribute

    public Object getAttribute(String name)

  Specified by:
    `getAttribute` in interface `javax.portlet.PortletRequest`

### getAttributeNames

    public Enumeration getAttributeNames()

  Specified by:
    `getAttributeNames` in interface `javax.portlet.PortletRequest`

### setParameters

    public void setParameters(Map parameters)

### setParameter

    public void setParameter(String key,
                             String value)

### setParameter

    public void setParameter(String key,
                             String[] values)

### addParameter

    public void addParameter(String name,
                             String value)

### addParameter

    public void addParameter(String name,
                             String[] values)

### getParameter

    public String getParameter(String name)

  Specified by:
    `getParameter` in interface `javax.portlet.PortletRequest`

### getParameterNames

    public Enumeration getParameterNames()

  Specified by:
    `getParameterNames` in interface `javax.portlet.PortletRequest`

### getParameterValues

    public String[] getParameterValues(String name)

  Specified by:
    `getParameterValues` in interface `javax.portlet.PortletRequest`

### getParameterMap

    public Map getParameterMap()

  Specified by:
    `getParameterMap` in interface `javax.portlet.PortletRequest`

### setSecure

    public void setSecure(boolean secure)

### isSecure

    public boolean isSecure()

  Specified by:
    `isSecure` in interface `javax.portlet.PortletRequest`

### setAttribute

    public void setAttribute(String name,
                             Object value)

  Specified by:
    `setAttribute` in interface `javax.portlet.PortletRequest`

### removeAttribute

    public void removeAttribute(String name)

  Specified by:
    `removeAttribute` in interface `javax.portlet.PortletRequest`

### getRequestedSessionId

    public String getRequestedSessionId()

  Specified by:
    `getRequestedSessionId` in interface `javax.portlet.PortletRequest`

### setRequestedSessionIdValid

    public void setRequestedSessionIdValid(boolean requestedSessionIdValid)

### isRequestedSessionIdValid

    public boolean isRequestedSessionIdValid()

  Specified by:
    `isRequestedSessionIdValid` in interface `javax.portlet.PortletRequest`

### addResponseContentType

    public void addResponseContentType(String responseContentType)

### addPreferredResponseContentType

    public void addPreferredResponseContentType(String responseContentType)

### getResponseContentType

    public String getResponseContentType()

  Specified by:
    `getResponseContentType` in interface `javax.portlet.PortletRequest`

### getResponseContentTypes

    public Enumeration getResponseContentTypes()

  Specified by:
    `getResponseContentTypes` in interface `javax.portlet.PortletRequest`

### addLocale

    public void addLocale(Locale locale)

### addPreferredLocale

    public void addPreferredLocale(Locale locale)

### getLocale

    public Locale getLocale()

  Specified by:
    `getLocale` in interface `javax.portlet.PortletRequest`

### getLocales

    public Enumeration getLocales()

  Specified by:
    `getLocales` in interface `javax.portlet.PortletRequest`

### setScheme

    public void setScheme(String scheme)

### getScheme

    public String getScheme()

  Specified by:
    `getScheme` in interface `javax.portlet.PortletRequest`

### setServerName

    public void setServerName(String serverName)

### getServerName

    public String getServerName()

  Specified by:
    `getServerName` in interface `javax.portlet.PortletRequest`

### setServerPort

    public void setServerPort(int serverPort)

### getServerPort

    public int getServerPort()

  Specified by:
    `getServerPort` in interface `javax.portlet.PortletRequest`

Copyright © 2002-2008 The Spring Framework.