public class MockPortletRequest
extends java.lang.Object
javax.portlet.PortletRequest
interface.Modifier and Type | Field and Description |
---|---|
private boolean |
active |
private java.util.Map<java.lang.String,java.lang.Object> |
attributes |
private java.lang.String |
authType |
private java.lang.String |
contextPath |
private Cookie[] |
cookies |
private java.util.List<java.util.Locale> |
locales |
private java.util.Map<java.lang.String,java.lang.String[]> |
parameters |
private PortalContext |
portalContext |
private PortletContext |
portletContext |
private PortletMode |
portletMode |
private PortletPreferences |
portletPreferences |
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
properties |
private java.util.Set<java.lang.String> |
publicParameterNames |
private java.lang.String |
remoteUser |
private boolean |
requestedSessionIdValid |
private java.util.List<java.lang.String> |
responseContentTypes |
private java.lang.String |
scheme |
private boolean |
secure |
private java.lang.String |
serverName |
private int |
serverPort |
private PortletSession |
session |
private java.security.Principal |
userPrincipal |
private java.util.Set<java.lang.String> |
userRoles |
private java.lang.String |
windowID |
private WindowState |
windowState |
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) |
private boolean active
private final PortalContext portalContext
private final PortletContext portletContext
private PortletSession session
private WindowState windowState
private PortletMode portletMode
private PortletPreferences portletPreferences
private final java.util.Map<java.lang.String,java.util.List<java.lang.String>> properties
private final java.util.Map<java.lang.String,java.lang.Object> attributes
private final java.util.Map<java.lang.String,java.lang.String[]> parameters
private java.lang.String authType
private java.lang.String contextPath
private java.lang.String remoteUser
private java.security.Principal userPrincipal
private final java.util.Set<java.lang.String> userRoles
private boolean secure
private boolean requestedSessionIdValid
private final java.util.List<java.lang.String> responseContentTypes
private final java.util.List<java.util.Locale> locales
private java.lang.String scheme
private java.lang.String serverName
private int serverPort
private java.lang.String windowID
private Cookie[] cookies
private final java.util.Set<java.lang.String> publicParameterNames
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)
public boolean isPortletModeAllowed(PortletMode portletMode)
public void setPortletMode(PortletMode portletMode)
public PortletMode getPortletMode()
public void setWindowState(WindowState windowState)
public WindowState getWindowState()
public void setPreferences(PortletPreferences preferences)
public PortletPreferences getPreferences()
public void setSession(PortletSession session)
public PortletSession getPortletSession()
public PortletSession getPortletSession(boolean create)
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)
public java.util.Enumeration<java.lang.String> getProperties(java.lang.String key)
public java.util.Enumeration<java.lang.String> getPropertyNames()
public PortalContext getPortalContext()
public void setAuthType(java.lang.String authType)
public java.lang.String getAuthType()
public void setContextPath(java.lang.String contextPath)
public java.lang.String getContextPath()
public void setRemoteUser(java.lang.String remoteUser)
public java.lang.String getRemoteUser()
public void setUserPrincipal(java.security.Principal userPrincipal)
public java.security.Principal getUserPrincipal()
public void addUserRole(java.lang.String role)
public boolean isUserInRole(java.lang.String role)
public java.lang.Object getAttribute(java.lang.String name)
public java.util.Enumeration<java.lang.String> getAttributeNames()
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)
public java.util.Enumeration<java.lang.String> getParameterNames()
public java.lang.String[] getParameterValues(java.lang.String name)
public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
public void setSecure(boolean secure)
public boolean isSecure()
public void setAttribute(java.lang.String name, java.lang.Object value)
public void removeAttribute(java.lang.String name)
public java.lang.String getRequestedSessionId()
public void setRequestedSessionIdValid(boolean requestedSessionIdValid)
public boolean isRequestedSessionIdValid()
public void addResponseContentType(java.lang.String responseContentType)
public void addPreferredResponseContentType(java.lang.String responseContentType)
public java.lang.String getResponseContentType()
public java.util.Enumeration<java.lang.String> getResponseContentTypes()
public void addLocale(java.util.Locale locale)
public void addPreferredLocale(java.util.Locale locale)
public java.util.Locale getLocale()
public java.util.Enumeration<java.util.Locale> getLocales()
public void setScheme(java.lang.String scheme)
public java.lang.String getScheme()
public void setServerName(java.lang.String serverName)
public java.lang.String getServerName()
public void setServerPort(int serverPort)
public int getServerPort()
public void setWindowID(java.lang.String windowID)
public java.lang.String getWindowID()
public void setCookies(Cookie... cookies)
public Cookie[] getCookies()
public java.util.Map<java.lang.String,java.lang.String[]> getPrivateParameterMap()
public java.util.Map<java.lang.String,java.lang.String[]> getPublicParameterMap()
public void registerPublicParameter(java.lang.String name)