public class MockRequestContext extends Object implements RequestContext
REQUEST_PORTALENV
Constructor and Description |
---|
MockRequestContext() |
MockRequestContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
MockRequestContext(String path) |
Modifier and Type | Method and Description |
---|---|
void |
clearThreadContext()
Clears the request context from the current thread
|
boolean |
ensureThreadContext()
The RequestContext itself is kept in a ThreadLocal, calling this method from another (parallel)
thread ensures its ThreadLocal instance will be synchronized with this instance as well.
|
PortletWindow |
getActionWindow()
Get the target Action Window
|
Object |
getAttribute(String key)
Get a request attribute associated with this single request.
|
CapabilityMap |
getCapabilityMap()
Get the Capability Map
|
String |
getCharacterEncoding()
get the character encoding
|
javax.servlet.ServletConfig |
getConfig()
Gets the HTTP Servlet Config
|
PortletWindow |
getCurrentPortletWindow() |
PortletWindow |
getInstantlyCreatedPortletWindow(String windowId,
String portletUniqueName) |
Locale |
getLocale()
Gets the locale associated with this request.
|
String |
getMediaType()
get the Media Type
|
List<KeyValue<String,HeadElement>> |
getMergedHeadElements()
Merges and returns the head elements contributed by portlets.
|
String |
getMimeType()
Get the mimeType for the request
|
NavigationalState |
getNavigationalState() |
Map |
getObjects()
Return a map of Jetspeed Request Context objects configured via Spring Map
|
ContentPage |
getPage()
Gets the target page for this request
|
Map |
getParameterMap()
Use this method to get a map of request parameters on the generalized request,
decoupling request parameter manipulation from servlet API.
|
String |
getPath()
Returns any extra path information associated with the URL the
client sent when it made this request.
|
Pipeline |
getPipeline()
Get the current executing pipeline
|
PortalURL |
getPortalURL()
Gets the Portal URL for the current request.
|
PortletWindow |
getPortletWindow(ContentFragment fragment) |
PortletWindow |
getPortletWindow(String windowId) |
Language |
getPreferedLanguage(PortletDefinition portlet)
getPreferedLanguage
|
Map |
getProfileLocators()
Gets the profile locators for this request
|
javax.servlet.http.HttpServletRequest |
getRequest()
Gets the HTTP Servlet Request.
|
javax.servlet.http.HttpServletRequest |
getRequestForWindow(PortletWindow window) |
String |
getRequestParameter(String key)
Use this method to get a request parameter on the generalized request,
decoupling request parameter manipulation from servlet API.
|
javax.servlet.http.HttpServletResponse |
getResponse()
Gets the HTTP Servlet Response.
|
javax.servlet.http.HttpServletResponse |
getResponseForWindow(PortletWindow window) |
Object |
getSessionAttribute(String key)
Gets an attribute from the session.
|
Subject |
getSubject()
Gets the subject associated with the authorized entity.
|
Map |
getUserInfoMap(String appName)
Returns the user info map of user attributes for a given portlet application.
|
Principal |
getUserPrincipal()
Gets the Jetspeed primary user principal associated with the authorized entity.
|
ContentPage |
locatePage(Profiler profiler,
PageLayoutComponent pageLayoutComponent,
String nonProfiledPath)
Locates a specific page using the profiler and site manager location algorithms
from a generalized non-profiled path to the first page matching the path
|
Throwable |
popActionFailure(PortletWindow window) |
PortletWindow |
resolvePortletWindow(String windowId) |
void |
setActionFailure(PortletWindow window,
Throwable actionFailure) |
void |
setActionWindow(PortletWindow window)
Sets the target Portlet Window
|
void |
setAttribute(String key,
Object value)
Sets an attribute into the request.
|
void |
setCapabilityMap(CapabilityMap map)
Set the capabilityMap.
|
void |
setCharacterEncoding(String enc)
set character encoding
|
void |
setCurrentPortletWindow(PortletWindow window) |
void |
setLocale(Locale locale)
Sets the locale associated with this request.
|
void |
setMediaType(String mediaType)
Set the mediaType.
|
void |
setMimeType(String mimeType)
Set the Mimetype.
|
void |
setObjects(Map objects) |
void |
setPage(ContentPage page)
Sets the target page for this request
|
void |
setPath(String path)
setPath
|
void |
setPipeline(Pipeline pipeline)
Set the current pipeline
|
void |
setPortalURL(PortalURL url)
Sets the Portal URL for the current request.
|
void |
setProfileLocators(Map locators)
Sets the target page profile locators for this request
|
void |
setRequest(javax.servlet.http.HttpServletRequest request)
Sets the HTTP Servlet Request.
|
void |
setResponse(javax.servlet.http.HttpServletResponse response)
Sets the HTTP Servlet Response.
|
void |
setSessionAttribute(String key,
Object value)
Sets an attribute into the session.
|
void |
setSubject(Subject subject)
Sets the subject associated with the authorized entity.
|
public MockRequestContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
public MockRequestContext()
public MockRequestContext(String path)
public Map getUserInfoMap(String appName)
RequestContext
getUserInfoMap
in interface RequestContext
appName
- The portlet application name.public PortletWindow getActionWindow()
RequestContext
getActionWindow
in interface RequestContext
public CapabilityMap getCapabilityMap()
RequestContext
getCapabilityMap
in interface RequestContext
public String getCharacterEncoding()
RequestContext
getCharacterEncoding
in interface RequestContext
public javax.servlet.ServletConfig getConfig()
RequestContext
getConfig
in interface RequestContext
public Locale getLocale()
RequestContext
getLocale
in interface RequestContext
public String getMediaType()
RequestContext
getMediaType
in interface RequestContext
public String getMimeType()
RequestContext
getMimeType
in interface RequestContext
public NavigationalState getNavigationalState()
public ContentPage getPage()
RequestContext
getPage
in interface RequestContext
public PortalURL getPortalURL()
RequestContext
getPortalURL
in interface RequestContext
null
value.public void setPortalURL(PortalURL url)
RequestContext
setPortalURL
in interface RequestContext
public Map getProfileLocators()
RequestContext
getProfileLocators
in interface RequestContext
public javax.servlet.http.HttpServletRequest getRequest()
RequestContext
getPortletRequestForWindow()
before
being processed by the portlet container.getRequest
in interface RequestContext
public javax.servlet.http.HttpServletRequest getRequestForWindow(PortletWindow window)
public javax.servlet.http.HttpServletResponse getResponse()
RequestContext
getPortletResponseForWindow()
before
being processed by the portlet container.getResponse
in interface RequestContext
public javax.servlet.http.HttpServletResponse getResponseForWindow(PortletWindow window)
public Subject getSubject()
RequestContext
getSubject
in interface RequestContext
public Principal getUserPrincipal()
RequestContext
getUserPrincipal
in interface RequestContext
public void setActionWindow(PortletWindow window)
RequestContext
setActionWindow
in interface RequestContext
public void setCapabilityMap(CapabilityMap map)
RequestContext
setCapabilityMap
in interface RequestContext
public void setCharacterEncoding(String enc)
RequestContext
setCharacterEncoding
in interface RequestContext
public void setLocale(Locale locale)
RequestContext
setLocale
in interface RequestContext
locale
- associated with this request.public void setMediaType(String mediaType)
RequestContext
setMediaType
in interface RequestContext
public void setMimeType(String mimeType)
RequestContext
setMimeType
in interface RequestContext
public void setPage(ContentPage page)
RequestContext
setPage
in interface RequestContext
page
- The target pagepublic void setProfileLocators(Map locators)
RequestContext
setProfileLocators
in interface RequestContext
locators
- The target profile locators by locator namepublic void setSubject(Subject subject)
RequestContext
setSubject
in interface RequestContext
subject
- The JAAS subject on this request.public String getRequestParameter(String key)
RequestContext
getRequestParameter
in interface RequestContext
key
- The parameter unique keypublic Map getParameterMap()
RequestContext
getParameterMap
in interface RequestContext
public void setSessionAttribute(String key, Object value)
RequestContext
setSessionAttribute
in interface RequestContext
key
- The key of the session attributevalue
- The value of the session attributepublic Object getSessionAttribute(String key)
RequestContext
getSessionAttribute
in interface RequestContext
key
- The key of the attributepublic void setAttribute(String key, Object value)
RequestContext
setAttribute
in interface RequestContext
key
- The key of the request attributevalue
- The value of the request attributepublic Object getAttribute(String key)
RequestContext
getAttribute
in interface RequestContext
key
- The key of the request attributepublic String getPath()
RequestContext
Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string. This method returns null if there was no extra path information.
This method should function identically to HttpServletRequest.getPathInfo()
except for that it removes ALL portal/portlet navigational state information from the
path info string.
getPath
in interface RequestContext
public Language getPreferedLanguage(PortletDefinition portlet)
getPreferedLanguage
getPreferedLanguage
in interface RequestContext
portlet
- org.apache.jetspeed.request.RequestContext#getPreferedLanguage(org.apache.pluto.container.om.portlet.PortletDefinition)
public void setPath(String path)
setPath
setPath
in interface RequestContext
path
- RequestContext.setPath(java.lang.String)
public Throwable popActionFailure(PortletWindow window)
popActionFailure
in interface RequestContext
public void setActionFailure(PortletWindow window, Throwable actionFailure)
setActionFailure
in interface RequestContext
window
- the window to set failed action onactionFailure
- The actionFailed to setpublic Pipeline getPipeline()
getPipeline
in interface RequestContext
public void setPipeline(Pipeline pipeline)
setPipeline
in interface RequestContext
pipeline
- public void setRequest(javax.servlet.http.HttpServletRequest request)
RequestContext
getPortletRequestForWindow()
before
being processed by the portlet container.setRequest
in interface RequestContext
request
- The request to set.public void setResponse(javax.servlet.http.HttpServletResponse response)
RequestContext
getPortletResponseForWindow()
before
being processed by the portlet container.setResponse
in interface RequestContext
response
- The request to set.public ContentPage locatePage(Profiler profiler, PageLayoutComponent pageLayoutComponent, String nonProfiledPath)
RequestContext
locatePage
in interface RequestContext
profiler
- The profiler component to use in the searchpageLayoutComponent
- The page layout component used to assemble the returned pagepublic Map getObjects()
RequestContext
getObjects
in interface RequestContext
public void setObjects(Map objects)
public PortletWindow getCurrentPortletWindow()
getCurrentPortletWindow
in interface RequestContext
public void setCurrentPortletWindow(PortletWindow window)
setCurrentPortletWindow
in interface RequestContext
public PortletWindow getPortletWindow(ContentFragment fragment)
getPortletWindow
in interface RequestContext
public PortletWindow getPortletWindow(String windowId)
getPortletWindow
in interface RequestContext
public PortletWindow getInstantlyCreatedPortletWindow(String windowId, String portletUniqueName)
getInstantlyCreatedPortletWindow
in interface RequestContext
public PortletWindow resolvePortletWindow(String windowId)
resolvePortletWindow
in interface RequestContext
public void clearThreadContext()
RequestContext
clearThreadContext
in interface RequestContext
public boolean ensureThreadContext()
RequestContext
This method will return true if this thread its ThreadLocal didn't yet have this RequestContext value set. In that case the calling code block, preferably in a finally statement should call clearThreadContext() to ensure the reference to this instance is removed again from its ThreadLocal instance as Thread Pool solutions might reuse threads.
ensureThreadContext
in interface RequestContext
public List<KeyValue<String,HeadElement>> getMergedHeadElements()
RequestContext
getMergedHeadElements
in interface RequestContext
Copyright © 1999–2016 The Apache Software Foundation. All rights reserved.