public class MockPortletRequest extends java.lang.Object implements PortletRequest
PortletRequest
interface.PortletRequest.P3PUserInfos
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 and Description |
---|
MockPortletRequest()
Create a new MockPortletRequest with a default
MockPortalContext
and a default MockPortletContext . |
MockPortletRequest(PortalContext portalContext,
PortletContext portletContext)
Create a new MockPortletRequest.
|
MockPortletRequest(PortletContext portletContext)
Create a new MockPortletRequest with a default
MockPortalContext . |
Modifier and Type | Method and Description |
---|---|
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() |
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) |
PortalContext |
getPortalContext() |
PortletMode |
getPortletMode() |
PortletSession |
getPortletSession() |
PortletSession |
getPortletSession(boolean create) |
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() |
WindowState |
getWindowState() |
boolean |
isActive()
Return whether this request is still active (that is, not completed yet).
|
boolean |
isPortletModeAllowed(PortletMode portletMode) |
boolean |
isRequestedSessionIdValid() |
boolean |
isSecure() |
boolean |
isUserInRole(java.lang.String role) |
boolean |
isWindowStateAllowed(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(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(PortletMode portletMode) |
void |
setPreferences(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(PortletSession session) |
void |
setUserPrincipal(java.security.Principal userPrincipal) |
void |
setWindowID(java.lang.String windowID) |
void |
setWindowState(WindowState windowState) |
public MockPortletRequest()
MockPortalContext
and a default MockPortletContext
.MockPortalContext
,
MockPortletContext
public MockPortletRequest(PortletContext portletContext)
MockPortalContext
.portletContext
- the PortletContext that the request runs inMockPortalContext
public MockPortletRequest(PortalContext portalContext, PortletContext portletContext)
portalContext
- the PortalContext that the request runs inportletContext
- the PortletContext that the request runs inprotected java.lang.String getLifecyclePhase()
public boolean isActive()
public void close()
protected void checkActive() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public boolean isWindowStateAllowed(WindowState windowState)
isWindowStateAllowed
in interface PortletRequest
public boolean isPortletModeAllowed(PortletMode portletMode)
isPortletModeAllowed
in interface PortletRequest
public void setPortletMode(PortletMode portletMode)
public PortletMode getPortletMode()
getPortletMode
in interface PortletRequest
public void setWindowState(WindowState windowState)
public WindowState getWindowState()
getWindowState
in interface PortletRequest
public void setPreferences(PortletPreferences preferences)
public PortletPreferences getPreferences()
getPreferences
in interface PortletRequest
public void setSession(PortletSession session)
public PortletSession getPortletSession()
getPortletSession
in interface PortletRequest
public PortletSession getPortletSession(boolean create)
getPortletSession
in interface PortletRequest
public void setProperty(java.lang.String key, java.lang.String value)
If there are already one or more values registered for the given property key, they will be replaced.
public void addProperty(java.lang.String key, java.lang.String value)
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.
public java.lang.String getProperty(java.lang.String key)
getProperty
in interface PortletRequest
public java.util.Enumeration<java.lang.String> getProperties(java.lang.String key)
getProperties
in interface PortletRequest
public java.util.Enumeration<java.lang.String> getPropertyNames()
getPropertyNames
in interface PortletRequest
public PortalContext getPortalContext()
getPortalContext
in interface PortletRequest
public void setAuthType(java.lang.String authType)
public java.lang.String getAuthType()
getAuthType
in interface PortletRequest
public void setContextPath(java.lang.String contextPath)
public java.lang.String getContextPath()
getContextPath
in interface PortletRequest
public void setRemoteUser(java.lang.String remoteUser)
public java.lang.String getRemoteUser()
getRemoteUser
in interface PortletRequest
public void setUserPrincipal(java.security.Principal userPrincipal)
public java.security.Principal getUserPrincipal()
getUserPrincipal
in interface PortletRequest
public void addUserRole(java.lang.String role)
public boolean isUserInRole(java.lang.String role)
isUserInRole
in interface PortletRequest
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface PortletRequest
public java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames
in interface PortletRequest
public void setParameters(java.util.Map<java.lang.String,java.lang.String[]> parameters)
public void setParameter(java.lang.String key, java.lang.String value)
public void setParameter(java.lang.String key, java.lang.String[] values)
public void addParameter(java.lang.String name, java.lang.String value)
public void addParameter(java.lang.String name, java.lang.String[] values)
public java.lang.String getParameter(java.lang.String name)
getParameter
in interface PortletRequest
public java.util.Enumeration<java.lang.String> getParameterNames()
getParameterNames
in interface PortletRequest
public java.lang.String[] getParameterValues(java.lang.String name)
getParameterValues
in interface PortletRequest
public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
getParameterMap
in interface PortletRequest
public void setSecure(boolean secure)
public boolean isSecure()
isSecure
in interface PortletRequest
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface PortletRequest
public void removeAttribute(java.lang.String name)
removeAttribute
in interface PortletRequest
public java.lang.String getRequestedSessionId()
getRequestedSessionId
in interface PortletRequest
public void setRequestedSessionIdValid(boolean requestedSessionIdValid)
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface PortletRequest
public void addResponseContentType(java.lang.String responseContentType)
public void addPreferredResponseContentType(java.lang.String responseContentType)
public java.lang.String getResponseContentType()
getResponseContentType
in interface PortletRequest
public java.util.Enumeration<java.lang.String> getResponseContentTypes()
getResponseContentTypes
in interface PortletRequest
public void addLocale(java.util.Locale locale)
public void addPreferredLocale(java.util.Locale locale)
public java.util.Locale getLocale()
getLocale
in interface PortletRequest
public java.util.Enumeration<java.util.Locale> getLocales()
getLocales
in interface PortletRequest
public void setScheme(java.lang.String scheme)
public java.lang.String getScheme()
getScheme
in interface PortletRequest
public void setServerName(java.lang.String serverName)
public java.lang.String getServerName()
getServerName
in interface PortletRequest
public void setServerPort(int serverPort)
public int getServerPort()
getServerPort
in interface PortletRequest
public void setWindowID(java.lang.String windowID)
public java.lang.String getWindowID()
getWindowID
in interface PortletRequest
public void setCookies(Cookie... cookies)
public Cookie[] getCookies()
getCookies
in interface PortletRequest
public java.util.Map<java.lang.String,java.lang.String[]> getPrivateParameterMap()
getPrivateParameterMap
in interface PortletRequest
public java.util.Map<java.lang.String,java.lang.String[]> getPublicParameterMap()
getPublicParameterMap
in interface PortletRequest
public void registerPublicParameter(java.lang.String name)