Spring Framework

org.springframework.mock.web.portlet
Class MockPortletRequest

java.lang.Object
  extended by org.springframework.mock.web.portlet.MockPortletRequest
All Implemented Interfaces:
javax.portlet.PortletRequest
Direct Known Subclasses:
MockClientDataRequest, MockEventRequest, MockRenderRequest

public class MockPortletRequest
extends java.lang.Object
implements javax.portlet.PortletRequest

Mock implementation of the PortletRequest interface.

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.portlet.PortletRequest
javax.portlet.PortletRequest.P3PUserInfos
 
Field Summary
 
Fields inherited from interface javax.portlet.PortletRequest
ACTION_PHASE, ACTION_SCOPE_ID, BASIC_AUTH, CCPP_PROFILE, CLIENT_CERT_AUTH, DIGEST_AUTH, EVENT_PHASE, FORM_AUTH, LIFECYCLE_PHASE, RENDER_HEADERS, RENDER_MARKUP, RENDER_PART, RENDER_PHASE, RESOURCE_PHASE, 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(java.util.Locale locale)
           
 void addParameter(java.lang.String name, java.lang.String value)
           
 void addParameter(java.lang.String name, java.lang.String[] values)
           
 void addPreferredLocale(java.util.Locale locale)
           
 void addPreferredResponseContentType(java.lang.String responseContentType)
           
 void addProperty(java.lang.String key, java.lang.String value)
          Add a single value for the specified property.
 void addResponseContentType(java.lang.String responseContentType)
           
 void addUserRole(java.lang.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.
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Enumeration<java.lang.String> getAttributeNames()
           
 java.lang.String getAuthType()
           
 java.lang.String getContextPath()
           
 javax.servlet.http.Cookie[] getCookies()
           
protected  java.lang.String getLifecyclePhase()
          Return the Portlet 2.0 lifecycle id for the current phase.
 java.util.Locale getLocale()
           
 java.util.Enumeration<java.util.Locale> getLocales()
           
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
           
 java.util.Enumeration<java.lang.String> getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
 javax.portlet.PortalContext getPortalContext()
           
 javax.portlet.PortletMode getPortletMode()
           
 javax.portlet.PortletSession getPortletSession()
           
 javax.portlet.PortletSession getPortletSession(boolean create)
           
 javax.portlet.PortletPreferences getPreferences()
           
 java.util.Map<java.lang.String,java.lang.String[]> getPrivateParameterMap()
           
 java.util.Enumeration<java.lang.String> getProperties(java.lang.String key)
           
 java.lang.String getProperty(java.lang.String key)
           
 java.util.Enumeration<java.lang.String> getPropertyNames()
           
 java.util.Map<java.lang.String,java.lang.String[]> getPublicParameterMap()
           
 java.lang.String getRemoteUser()
           
 java.lang.String getRequestedSessionId()
           
 java.lang.String getResponseContentType()
           
 java.util.Enumeration<java.lang.String> getResponseContentTypes()
           
 java.lang.String getScheme()
           
 java.lang.String getServerName()
           
 int getServerPort()
           
 java.security.Principal getUserPrincipal()
           
 java.lang.String getWindowID()
           
 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(java.lang.String role)
           
 boolean isWindowStateAllowed(javax.portlet.WindowState windowState)
           
 void registerPublicParameter(java.lang.String name)
           
 void removeAttribute(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 void setAuthType(java.lang.String authType)
           
 void setContextPath(java.lang.String contextPath)
           
 void setCookies(javax.servlet.http.Cookie... cookies)
           
 void setParameter(java.lang.String key, java.lang.String value)
           
 void setParameter(java.lang.String key, java.lang.String[] values)
           
 void setParameters(java.util.Map<java.lang.String,java.lang.String[]> parameters)
           
 void setPortletMode(javax.portlet.PortletMode portletMode)
           
 void setPreferences(javax.portlet.PortletPreferences preferences)
           
 void setProperty(java.lang.String key, java.lang.String value)
          Set a single value for the specified property.
 void setRemoteUser(java.lang.String remoteUser)
           
 void setRequestedSessionIdValid(boolean requestedSessionIdValid)
           
 void setScheme(java.lang.String scheme)
           
 void setSecure(boolean secure)
           
 void setServerName(java.lang.String serverName)
           
 void setServerPort(int serverPort)
           
 void setSession(javax.portlet.PortletSession session)
           
 void setUserPrincipal(java.security.Principal userPrincipal)
           
 void setWindowID(java.lang.String windowID)
           
 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

getLifecyclePhase

protected java.lang.String getLifecyclePhase()
Return the Portlet 2.0 lifecycle id for the current phase.


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 java.lang.IllegalStateException
Check whether this request is still active (that is, not completed yet), throwing an IllegalStateException if not active anymore.

Throws:
java.lang.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(java.lang.String key,
                        java.lang.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(java.lang.String key,
                        java.lang.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 java.lang.String getProperty(java.lang.String key)
Specified by:
getProperty in interface javax.portlet.PortletRequest

getProperties

public java.util.Enumeration<java.lang.String> getProperties(java.lang.String key)
Specified by:
getProperties in interface javax.portlet.PortletRequest

getPropertyNames

public java.util.Enumeration<java.lang.String> 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(java.lang.String authType)

getAuthType

public java.lang.String getAuthType()
Specified by:
getAuthType in interface javax.portlet.PortletRequest

setContextPath

public void setContextPath(java.lang.String contextPath)

getContextPath

public java.lang.String getContextPath()
Specified by:
getContextPath in interface javax.portlet.PortletRequest

setRemoteUser

public void setRemoteUser(java.lang.String remoteUser)

getRemoteUser

public java.lang.String getRemoteUser()
Specified by:
getRemoteUser in interface javax.portlet.PortletRequest

setUserPrincipal

public void setUserPrincipal(java.security.Principal userPrincipal)

getUserPrincipal

public java.security.Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface javax.portlet.PortletRequest

addUserRole

public void addUserRole(java.lang.String role)

isUserInRole

public boolean isUserInRole(java.lang.String role)
Specified by:
isUserInRole in interface javax.portlet.PortletRequest

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Specified by:
getAttribute in interface javax.portlet.PortletRequest

getAttributeNames

public java.util.Enumeration<java.lang.String> getAttributeNames()
Specified by:
getAttributeNames in interface javax.portlet.PortletRequest

setParameters

public void setParameters(java.util.Map<java.lang.String,java.lang.String[]> parameters)

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String[] values)

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String value)

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String[] values)

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in interface javax.portlet.PortletRequest

getParameterNames

public java.util.Enumeration<java.lang.String> getParameterNames()
Specified by:
getParameterNames in interface javax.portlet.PortletRequest

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Specified by:
getParameterValues in interface javax.portlet.PortletRequest

getParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> 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(java.lang.String name,
                         java.lang.Object value)
Specified by:
setAttribute in interface javax.portlet.PortletRequest

removeAttribute

public void removeAttribute(java.lang.String name)
Specified by:
removeAttribute in interface javax.portlet.PortletRequest

getRequestedSessionId

public java.lang.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(java.lang.String responseContentType)

addPreferredResponseContentType

public void addPreferredResponseContentType(java.lang.String responseContentType)

getResponseContentType

public java.lang.String getResponseContentType()
Specified by:
getResponseContentType in interface javax.portlet.PortletRequest

getResponseContentTypes

public java.util.Enumeration<java.lang.String> getResponseContentTypes()
Specified by:
getResponseContentTypes in interface javax.portlet.PortletRequest

addLocale

public void addLocale(java.util.Locale locale)

addPreferredLocale

public void addPreferredLocale(java.util.Locale locale)

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface javax.portlet.PortletRequest

getLocales

public java.util.Enumeration<java.util.Locale> getLocales()
Specified by:
getLocales in interface javax.portlet.PortletRequest

setScheme

public void setScheme(java.lang.String scheme)

getScheme

public java.lang.String getScheme()
Specified by:
getScheme in interface javax.portlet.PortletRequest

setServerName

public void setServerName(java.lang.String serverName)

getServerName

public java.lang.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

setWindowID

public void setWindowID(java.lang.String windowID)

getWindowID

public java.lang.String getWindowID()
Specified by:
getWindowID in interface javax.portlet.PortletRequest

setCookies

public void setCookies(javax.servlet.http.Cookie... cookies)

getCookies

public javax.servlet.http.Cookie[] getCookies()
Specified by:
getCookies in interface javax.portlet.PortletRequest

getPrivateParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getPrivateParameterMap()
Specified by:
getPrivateParameterMap in interface javax.portlet.PortletRequest

getPublicParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getPublicParameterMap()
Specified by:
getPublicParameterMap in interface javax.portlet.PortletRequest

registerPublicParameter

public void registerPublicParameter(java.lang.String name)

Spring Framework