org.apache.jetspeed.mockobjects.request
Class MockRequestContext

java.lang.Object
  extended by org.apache.jetspeed.mockobjects.request.MockRequestContext
All Implemented Interfaces:
RequestContext

public class MockRequestContext
extends Object
implements RequestContext

MockRequestContext

Version:
$Id: MockRequestContext.java,v 1.1.2.1 2004/04/20 19:40:40 weaver Exp $
Author:
David Sean Taylor

Field Summary
private  Locale locale
           
private  Map locators
           
private  String mediaType
           
private  String mimeType
           
private  Map objects
           
private  ContentPage page
           
private  String path
           
private  Pipeline pipeline
           
private  javax.servlet.http.HttpServletRequest request
           
private  Map requestAttributes
           
private  Map requestParameters
           
private  javax.servlet.http.HttpServletResponse response
           
private  Object session
           
private  Map sessionAttributes
           
private  Subject subject
           
 
Fields inherited from interface org.apache.jetspeed.request.RequestContext
REQUEST_PORTALENV
 
Constructor Summary
MockRequestContext()
           
MockRequestContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
MockRequestContext(String path)
           
 
Method Summary
 org.apache.pluto.om.window.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
 ContentDispatcher getContentDispatcher()
          Gets the content dispatcher for this request
 Locale getLocale()
          Gets the locale associated with this request.
 String getMediaType()
          get the Media Type
 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.
 org.apache.pluto.om.common.Language getPreferedLanguage(org.apache.pluto.om.portlet.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(org.apache.pluto.om.window.PortletWindow window)
           getRequestForWindow
 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(org.apache.pluto.om.window.PortletWindow window)
           getResponseForWindow
 Object getSessionAttribute(String key)
          Gets an attribute from the session.
 Subject getSubject()
          Gets the subject associated with the authorized entity.
 Map getUserInfoMap(org.apache.pluto.om.common.ObjectID oid)
          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, 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(org.apache.pluto.om.window.PortletWindow window)
           
 void setActionFailure(org.apache.pluto.om.window.PortletWindow window, Throwable actionFailure)
           
 void setActionWindow(org.apache.pluto.om.window.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 setContentDispatcher(ContentDispatcher dispatcher)
          Sets the content dispatcher for this request
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requestParameters

private Map requestParameters

requestAttributes

private Map requestAttributes

sessionAttributes

private Map sessionAttributes

path

private String path

locators

private Map locators

subject

private Subject subject

locale

private Locale locale

mediaType

private String mediaType

mimeType

private String mimeType

page

private ContentPage page

request

private javax.servlet.http.HttpServletRequest request

response

private javax.servlet.http.HttpServletResponse response

session

private Object session

pipeline

private Pipeline pipeline

objects

private Map objects
Constructor Detail

MockRequestContext

public MockRequestContext(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)

MockRequestContext

public MockRequestContext()

MockRequestContext

public MockRequestContext(String path)
Method Detail

getUserInfoMap

public Map getUserInfoMap(org.apache.pluto.om.common.ObjectID oid)
Description copied from interface: RequestContext
Returns the user info map of user attributes for a given portlet application.

Specified by:
getUserInfoMap in interface RequestContext
Parameters:
oid - The portlet application object id.
Returns:
The PortletRequest.USER_INFO map.

getActionWindow

public org.apache.pluto.om.window.PortletWindow getActionWindow()
Description copied from interface: RequestContext
Get the target Action Window

Specified by:
getActionWindow in interface RequestContext
Returns:
PortletWindow The target portlet action window

getCapabilityMap

public CapabilityMap getCapabilityMap()
Description copied from interface: RequestContext
Get the Capability Map

Specified by:
getCapabilityMap in interface RequestContext

getCharacterEncoding

public String getCharacterEncoding()
Description copied from interface: RequestContext
get the character encoding

Specified by:
getCharacterEncoding in interface RequestContext

getConfig

public javax.servlet.ServletConfig getConfig()
Description copied from interface: RequestContext
Gets the HTTP Servlet Config

Specified by:
getConfig in interface RequestContext
Returns:
ServletConfig

getContentDispatcher

public ContentDispatcher getContentDispatcher()
Description copied from interface: RequestContext
Gets the content dispatcher for this request

Specified by:
getContentDispatcher in interface RequestContext
Returns:
ContentDispatcher

getLocale

public Locale getLocale()
Description copied from interface: RequestContext
Gets the locale associated with this request.

Specified by:
getLocale in interface RequestContext
Returns:
The locale associated with this request.

getMediaType

public String getMediaType()
Description copied from interface: RequestContext
get the Media Type

Specified by:
getMediaType in interface RequestContext

getMimeType

public String getMimeType()
Description copied from interface: RequestContext
Get the mimeType for the request

Specified by:
getMimeType in interface RequestContext

getNavigationalState

public NavigationalState getNavigationalState()

getPage

public ContentPage getPage()
Description copied from interface: RequestContext
Gets the target page for this request

Specified by:
getPage in interface RequestContext
Returns:
Page

getPortalURL

public PortalURL getPortalURL()
Description copied from interface: RequestContext
Gets the Portal URL for the current request.

Specified by:
getPortalURL in interface RequestContext
Returns:
The Portal URL object for the current request. This method will never return a null value.

setPortalURL

public void setPortalURL(PortalURL url)
Description copied from interface: RequestContext
Sets the Portal URL for the current request.

Specified by:
setPortalURL in interface RequestContext

getProfileLocators

public Map getProfileLocators()
Description copied from interface: RequestContext
Gets the profile locators for this request

Specified by:
getProfileLocators in interface RequestContext
Returns:
Profile locators by locator name

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Description copied from interface: RequestContext
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.

Specified by:
getRequest in interface RequestContext
Returns:
HttpServletRequest

getRequestForWindow

public javax.servlet.http.HttpServletRequest getRequestForWindow(org.apache.pluto.om.window.PortletWindow window)
Description copied from interface: RequestContext

getRequestForWindow

Takes a PortletWindow and generates a HttpServletRequest that accurately represents that PortletWindow's request parameters

Specified by:
getRequestForWindow in interface RequestContext
Parameters:
window - PortletWindow that we are build a request for
Returns:
HttpServletRequest that wraps the existing servlet container's request that can interpret encoded portlet information for this PortletWindow

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Description copied from interface: RequestContext
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.

Specified by:
getResponse in interface RequestContext
Returns:
HttpServletResponse

getResponseForWindow

public javax.servlet.http.HttpServletResponse getResponseForWindow(org.apache.pluto.om.window.PortletWindow window)
Description copied from interface: RequestContext

getResponseForWindow

Takes a PortletWindow and generates a HttpServletResponse that accurately represents that PortletWindow's request parameters.

Specified by:
getResponseForWindow in interface RequestContext
Parameters:
window - PortletWindow that we are build a response for
Returns:
HttpServletRequest that wraps the existing servlet container's request that can interpret encoded portlet information for this PortletWindow

getSubject

public Subject getSubject()
Description copied from interface: RequestContext
Gets the subject associated with the authorized entity. This subject can be used to provide credentials and principals.

Specified by:
getSubject in interface RequestContext
Returns:
The JAAS subject on this request.

getUserPrincipal

public Principal getUserPrincipal()
Description copied from interface: RequestContext
Gets the Jetspeed primary user principal associated with the authorized entity.

Specified by:
getUserPrincipal in interface RequestContext
Returns:
The primary principal on this request.

setActionWindow

public void setActionWindow(org.apache.pluto.om.window.PortletWindow window)
Description copied from interface: RequestContext
Sets the target Portlet Window

Specified by:
setActionWindow in interface RequestContext

setCapabilityMap

public void setCapabilityMap(CapabilityMap map)
Description copied from interface: RequestContext
Set the capabilityMap. Used by the CapabilityValve

Specified by:
setCapabilityMap in interface RequestContext

setCharacterEncoding

public void setCharacterEncoding(String enc)
Description copied from interface: RequestContext
set character encoding

Specified by:
setCharacterEncoding in interface RequestContext

setContentDispatcher

public void setContentDispatcher(ContentDispatcher dispatcher)
Description copied from interface: RequestContext
Sets the content dispatcher for this request

Specified by:
setContentDispatcher in interface RequestContext
Parameters:
dispatcher - The ContentDispatcher to use for this request

setLocale

public void setLocale(Locale locale)
Description copied from interface: RequestContext
Sets the locale associated with this request.

Specified by:
setLocale in interface RequestContext

setMediaType

public void setMediaType(String mediaType)
Description copied from interface: RequestContext
Set the mediaType. Set by the CapabilityValve

Specified by:
setMediaType in interface RequestContext

setMimeType

public void setMimeType(String mimeType)
Description copied from interface: RequestContext
Set the Mimetype. Set by the CapabilityValve

Specified by:
setMimeType in interface RequestContext

setPage

public void setPage(ContentPage page)
Description copied from interface: RequestContext
Sets the target page for this request

Specified by:
setPage in interface RequestContext
Parameters:
page - The target page

setProfileLocators

public void setProfileLocators(Map locators)
Description copied from interface: RequestContext
Sets the target page profile locators for this request

Specified by:
setProfileLocators in interface RequestContext
Parameters:
locators - The target profile locators by locator name

setSubject

public void setSubject(Subject subject)
Description copied from interface: RequestContext
Sets the subject associated with the authorized entity. This subject can be used to provide credentials and principals.

Specified by:
setSubject in interface RequestContext
Parameters:
subject - The JAAS subject on this request.

getRequestParameter

public String getRequestParameter(String key)
Description copied from interface: RequestContext
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.

Specified by:
getRequestParameter in interface RequestContext
Parameters:
key - The parameter unique key
Returns:
The object associated with the uniqu

getParameterMap

public Map getParameterMap()
Description copied from interface: RequestContext
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.

Specified by:
getParameterMap in interface RequestContext
Returns:

setSessionAttribute

public void setSessionAttribute(String key,
                                Object value)
Description copied from interface: RequestContext
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.

Specified by:
setSessionAttribute in interface RequestContext
Parameters:
key - The key of the session attribute
value - The value of the session attribute

getSessionAttribute

public Object getSessionAttribute(String key)
Description copied from interface: RequestContext
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.

Specified by:
getSessionAttribute in interface RequestContext
Parameters:
key - The key of the attribute
Returns:
The value of the attribute

setAttribute

public void setAttribute(String key,
                         Object value)
Description copied from interface: RequestContext
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.

Specified by:
setAttribute in interface RequestContext
Parameters:
key - The key of the request attribute
value - The value of the request attribute

getAttribute

public Object getAttribute(String key)
Description copied from interface: RequestContext
Get a request attribute associated with this single request.

Specified by:
getAttribute in interface RequestContext
Parameters:
key - The key of the request attribute
Returns:
The value of the request attribute

getPath

public String getPath()
Description copied from interface: 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.

Specified by:
getPath in interface RequestContext
Returns:
the path

getPreferedLanguage

public org.apache.pluto.om.common.Language getPreferedLanguage(org.apache.pluto.om.portlet.PortletDefinition portlet)

getPreferedLanguage

Specified by:
getPreferedLanguage in interface RequestContext
Parameters:
portlet -
Returns:
See Also:
RequestContext.getPreferedLanguage(org.apache.pluto.om.portlet.PortletDefinition)

setPath

public void setPath(String path)

setPath

Specified by:
setPath in interface RequestContext
Parameters:
path -
See Also:
RequestContext.setPath(java.lang.String)

popActionFailure

public Throwable popActionFailure(org.apache.pluto.om.window.PortletWindow window)
Specified by:
popActionFailure in interface RequestContext
Returns:

setActionFailure

public void setActionFailure(org.apache.pluto.om.window.PortletWindow window,
                             Throwable actionFailure)
Specified by:
setActionFailure in interface RequestContext

getPipeline

public Pipeline getPipeline()
Get the current executing pipeline

Specified by:
getPipeline in interface RequestContext
Returns:
Pipeline

setPipeline

public void setPipeline(Pipeline pipeline)
Set the current pipeline

Specified by:
setPipeline in interface RequestContext
Parameters:
pipeline -

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest request)
Description copied from interface: RequestContext
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.

Specified by:
setRequest in interface RequestContext
Parameters:
request - The request to set.

setResponse

public void setResponse(javax.servlet.http.HttpServletResponse response)
Description copied from interface: RequestContext
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.

Specified by:
setResponse in interface RequestContext
Parameters:
response - The request to set.

locatePage

public ContentPage locatePage(Profiler profiler,
                              String nonProfiledPath)
Description copied from interface: RequestContext
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

Specified by:
locatePage in interface RequestContext
Parameters:
profiler - The profiler component to use in the search
Returns:
A Content Page located by the profiler, or null if not found

getObjects

public Map getObjects()
Description copied from interface: RequestContext
Return a map of Jetspeed Request Context objects configured via Spring Map

Specified by:
getObjects in interface RequestContext
Returns:
a Map of request context objects

setObjects

public void setObjects(Map objects)


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.