org.apache.jetspeed.request
Interface RequestContext

All Known Implementing Classes:
MockRequestContext

public interface RequestContext

Portal Request Context is associated with each request

Version:
$Id: RequestContext.java,v 1.14 2005/04/29 14:00:48 weaver Exp $
Author:
David Sean Taylor

Field Summary
static java.lang.String REQUEST_PORTALENV
           
 
Method Summary
 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
 java.lang.Object getAttribute(java.lang.String key)
          Get a request attribute associated with this single request.
 CapabilityMap getCapabilityMap()
          Get the Capability Map
 java.lang.String getCharacterEncoding()
          get the character encoding
 javax.servlet.ServletConfig getConfig()
          Gets the HTTP Servlet Config
 PortletWindow getCurrentPortletWindow()
           
 PortletWindow getInstantlyCreatedPortletWindow(java.lang.String windowId, java.lang.String portletUniqueName)
           
 java.util.Locale getLocale()
          Gets the locale associated with this request.
 java.lang.String getMediaType()
          get the Media Type
 java.util.List<KeyValue<java.lang.String,HeadElement>> getMergedHeadElements()
          Merges and returns the head elements contributed by portlets.
 java.lang.String getMimeType()
          Get the mimeType for the request
 java.util.Map<java.lang.String,java.lang.Object> getObjects()
          Return a map of Jetspeed Request Context objects configured via Spring Map
 ContentPage getPage()
          Gets the target page for this request
 java.util.Map getParameterMap()
          Use this method to get a map of request parameters on the generalized request, decoupling request parameter manipulation from servlet API.
 java.lang.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(java.lang.String windowId)
           
 Language getPreferedLanguage(PortletDefinition portlet)
           getPreferedLanguage
 java.util.Map getProfileLocators()
          Gets the profile locators for this request
 javax.servlet.http.HttpServletRequest getRequest()
          Gets the HTTP Servlet Request.
 java.lang.String getRequestParameter(java.lang.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.
 java.lang.Object getSessionAttribute(java.lang.String key)
          Gets an attribute from the session.
 javax.security.auth.Subject getSubject()
          Gets the subject associated with the authorized entity.
 java.util.Map<java.lang.String,java.lang.String> getUserInfoMap(java.lang.String appName)
          Returns the user info map of user attributes for a given portlet application.
 java.security.Principal getUserPrincipal()
          Gets the Jetspeed primary user principal associated with the authorized entity.
 ContentPage locatePage(Profiler profiler, PageLayoutComponent pageLayoutComponent, java.lang.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
 java.lang.Throwable popActionFailure(PortletWindow window)
           
 PortletWindow resolvePortletWindow(java.lang.String windowId)
           
 void setActionFailure(PortletWindow window, java.lang.Throwable actionFailure)
           
 void setActionWindow(PortletWindow window)
          Sets the target Portlet Window
 void setAttribute(java.lang.String key, java.lang.Object value)
          Sets an attribute into the request.
 void setCapabilityMap(CapabilityMap map)
          Set the capabilityMap.
 void setCharacterEncoding(java.lang.String enc)
          set character encoding
 void setCurrentPortletWindow(PortletWindow window)
           
 void setLocale(java.util.Locale locale)
          Sets the locale associated with this request.
 void setMediaType(java.lang.String mediaType)
          Set the mediaType.
 void setMimeType(java.lang.String mimeType)
          Set the Mimetype.
 void setPage(ContentPage page)
          Sets the target page for this request
 void setPath(java.lang.String path)
           setPath
 void setPipeline(Pipeline pipeline)
          Set the current pipeline
 void setPortalURL(PortalURL portalUrl)
          Sets the Portal URL for the current request.
 void setProfileLocators(java.util.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(java.lang.String key, java.lang.Object value)
          Sets an attribute into the session.
 void setSubject(javax.security.auth.Subject subject)
          Sets the subject associated with the authorized entity.
 

Field Detail

REQUEST_PORTALENV

static final java.lang.String REQUEST_PORTALENV
See Also:
Constant Field Values
Method Detail

getRequest

javax.servlet.http.HttpServletRequest getRequest()
Gets the HTTP Servlet Request. This is the Servlet containers raw request object. This request should be wrapped using getPortletRequestForWindow() before being processed by the portlet container.

Returns:
HttpServletRequest

setRequest

void setRequest(javax.servlet.http.HttpServletRequest request)
Sets the HTTP Servlet Request. This is the Servlet containers raw request object. This request should be wrapped using getPortletRequestForWindow() before being processed by the portlet container.


getResponse

javax.servlet.http.HttpServletResponse getResponse()
Gets the HTTP Servlet Response. This is the Servlet containers raw response object. This response should be wrapped using getPortletResponseForWindow() before being processed by the portlet container.

Returns:
HttpServletResponse

setResponse

void setResponse(javax.servlet.http.HttpServletResponse response)
Sets the HTTP Servlet Response. This is the Servlet containers raw response object. This response should be wrapped using getPortletResponseForWindow() before being processed by the portlet container.


getConfig

javax.servlet.ServletConfig getConfig()
Gets the HTTP Servlet Config

Returns:
ServletConfig

getProfileLocators

java.util.Map getProfileLocators()
Gets the profile locators for this request

Returns:
Profile locators by locator name

setProfileLocators

void setProfileLocators(java.util.Map locators)
Sets the target page profile locators for this request

Parameters:
locators - The target profile locators by locator name

getPage

ContentPage getPage()
Gets the target page for this request

Returns:
Page

setPage

void setPage(ContentPage page)
Sets the target page for this request

Parameters:
page - The target page

setCapabilityMap

void setCapabilityMap(CapabilityMap map)
Set the capabilityMap. Used by the CapabilityValve

Parameters:
capabilityMap -

getCapabilityMap

CapabilityMap getCapabilityMap()
Get the Capability Map


setMimeType

void setMimeType(java.lang.String mimeType)
Set the Mimetype. Set by the CapabilityValve

Parameters:
mimeType -

getMimeType

java.lang.String getMimeType()
Get the mimeType for the request


setMediaType

void setMediaType(java.lang.String mediaType)
Set the mediaType. Set by the CapabilityValve

Parameters:
mediaType -

getMediaType

java.lang.String getMediaType()
get the Media Type


getPortalURL

PortalURL getPortalURL()
Gets the Portal URL for the current request.

Returns:
The Portal URL object for the current request. This method will never return a null value.
Throws:
java.lang.IllegalStateException - if portalUrl if has not been set.

setPortalURL

void setPortalURL(PortalURL portalUrl)
Sets the Portal URL for the current request.

Throws:
java.lang.IllegalStateException - if portalUrl has been set already.
java.lang.IllegalArgumentException - if a null value is passed in.

getActionWindow

PortletWindow getActionWindow()
Get the target Action Window

Returns:
PortletWindow The target portlet action window

setActionWindow

void setActionWindow(PortletWindow window)
Sets the target Portlet Window

Parameters:
window -

getCharacterEncoding

java.lang.String getCharacterEncoding()
get the character encoding


setCharacterEncoding

void setCharacterEncoding(java.lang.String enc)
set character encoding

Parameters:
enc -

getPortletWindow

PortletWindow getPortletWindow(java.lang.String windowId)

getPortletWindow

PortletWindow getPortletWindow(ContentFragment fragment)

getInstantlyCreatedPortletWindow

PortletWindow getInstantlyCreatedPortletWindow(java.lang.String windowId,
                                               java.lang.String portletUniqueName)

resolvePortletWindow

PortletWindow resolvePortletWindow(java.lang.String windowId)

getCurrentPortletWindow

PortletWindow getCurrentPortletWindow()

setCurrentPortletWindow

void setCurrentPortletWindow(PortletWindow window)

getSubject

javax.security.auth.Subject getSubject()
Gets the subject associated with the authorized entity. This subject can be used to provide credentials and principals.

Returns:
The JAAS subject on this request.

setSubject

void setSubject(javax.security.auth.Subject subject)
Sets the subject associated with the authorized entity. This subject can be used to provide credentials and principals.

Parameters:
subject - The JAAS subject on this request.

getLocale

java.util.Locale getLocale()
Gets the locale associated with this request.

Returns:
The locale associated with this request.

setLocale

void setLocale(java.util.Locale locale)
Sets the locale associated with this request.

Parameters:
The - locale associated with this request.

getRequestParameter

java.lang.String getRequestParameter(java.lang.String key)
Use this method to get a request parameter on the generalized request, decoupling request parameter manipulation from servlet API. This parameter could be on the Http Servlet request, in that case it simply passes through to the servlet request.

Parameters:
key - The parameter unique key
Returns:
The object associated with the uniqu

getParameterMap

java.util.Map getParameterMap()
Use this method to get a map of request parameters on the generalized request, decoupling request parameter manipulation from servlet API. The parameters returned could be on the Http Servlet request, in that case it simply passes through to the servlet request.

Returns:

getSessionAttribute

java.lang.Object getSessionAttribute(java.lang.String key)
Gets an attribute from the session. This method is decoupled from the servlet api request to facilitate abstractions for testing and other programs not connected to a servlet application.

Parameters:
key - The key of the attribute
Returns:
The value of the attribute

setSessionAttribute

void setSessionAttribute(java.lang.String key,
                         java.lang.Object value)
Sets an attribute into the session. This method is decoupled from the servlet api request to facilitate abstractions for testing and other programs not connected to a servlet application.

Parameters:
key - The key of the session attribute
value - The value of the session attribute

getAttribute

java.lang.Object getAttribute(java.lang.String key)
Get a request attribute associated with this single request.

Parameters:
key - The key of the request attribute
Returns:
The value of the request attribute

setAttribute

void setAttribute(java.lang.String key,
                  java.lang.Object value)
Sets an attribute into the request. This method is decoupled from the servlet api request to facilitate abstractions for testing and other programs not connected to a servlet application.

Parameters:
key - The key of the request attribute
value - The value of the request attribute

getPath

java.lang.String getPath()

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.

Returns:
the path

setPath

void setPath(java.lang.String path)

setPath

Allows the manual overriding of path Jetspeed 2 will look to resolves pages and folders.

Parameters:
path -

getUserInfoMap

java.util.Map<java.lang.String,java.lang.String> getUserInfoMap(java.lang.String appName)
Returns the user info map of user attributes for a given portlet application.

Parameters:
appName - The portlet application name.
Returns:
The PortletRequest.USER_INFO map.

getPreferedLanguage

Language getPreferedLanguage(PortletDefinition portlet)

getPreferedLanguage

Returns the Language object for the portlet which most closely matches the prefences of the currently requesting client.

Parameters:
portlet -
Returns:
Language that matches, as closely as possible, that of the requesting client.

popActionFailure

java.lang.Throwable popActionFailure(PortletWindow window)
Returns:

setActionFailure

void setActionFailure(PortletWindow window,
                      java.lang.Throwable actionFailure)
Parameters:
actionFailed - The actionFailed to set.

getPipeline

Pipeline getPipeline()
Get the current executing pipeline

Returns:
Pipeline

setPipeline

void setPipeline(Pipeline pipeline)
Set the current pipeline

Parameters:
pipeline -

getUserPrincipal

java.security.Principal getUserPrincipal()
Gets the Jetspeed primary user principal associated with the authorized entity.

Returns:
The primary principal on this request.

locatePage

ContentPage locatePage(Profiler profiler,
                       PageLayoutComponent pageLayoutComponent,
                       java.lang.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

Parameters:
profiler - The profiler component to use in the search
pageLayoutComponent - The page layout component used to assemble the returned page
Returns:
A Content Page located by the profiler, or null if not found

getObjects

java.util.Map<java.lang.String,java.lang.Object> getObjects()
Return a map of Jetspeed Request Context objects configured via Spring Map

Returns:
a Map of request context objects
Since:
2.1.2

ensureThreadContext

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.

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.

Returns:
true if the current thread didn't have this request context set or contained a different (stale/left over?) request context

clearThreadContext

void clearThreadContext()
Clears the request context from the current thread


getMergedHeadElements

java.util.List<KeyValue<java.lang.String,HeadElement>> getMergedHeadElements()
Merges and returns the head elements contributed by portlets.

Returns:


Copyright © 1999-2011 The Apache Software Foundation. All Rights Reserved.