org.springframework.extensions.surf
Class WrappedRequestContext

java.lang.Object
  extended by org.springframework.extensions.surf.WrappedRequestContext
All Implemented Interfaces:
Serializable, RequestContext
Direct Known Subclasses:
AbstractRenderContext, WrappedRenderContext

public class WrappedRequestContext
extends Object
implements RequestContext

Author:
muzquiano
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.springframework.extensions.surf.RequestContext
ATTR_REQUEST_CONTEXT, DEBUG_MODE_VALUE_COMPONENTS, VALUE_CREDENTIAL_VAULT, VALUE_HEAD_TAGS, VALUE_IDENTITY_VAULT
 
Constructor Summary
WrappedRequestContext(RequestContext context)
           
 
Method Summary
 CredentialVault getCredentialVault()
          Returns the credential vault
 Resource getCurrentObject()
          Returns the current object If no object has been set, then null is returned
 String getCurrentObjectId()
          Returns the id of the current object If no object has been set, then the id will be null.
 String getFormatId()
          Returns the current format id
 String getId()
          Each request context instance is stamped with a unique id
 LinkBuilder getLinkBuilder()
          Returns the LinkBuilder to be used for the currently executing page.
 Model getModel()
          Returns the model.
 RequestContext getOriginalContext()
           
 Page getPage()
          If a page instance is currently executing, it can be retrieved from the request context.
 String getPageId()
          Returns the id of the currently executing page.
 String getPageTitle()
          Returns the title of the current page.
 Serializable getParameter(String key)
          Retrieves a parameter from the request context
 Map<String,Serializable> getParameters()
          Returns a map of parameters
 Component[] getRenderingComponents()
          Returns the components that were bound to this and any of its parent context during the rendering.
 javax.servlet.http.HttpServletRequest getRequest()
          Returns the HTTP Servlet Request bound to this request
 Content getRequestContent()
          Returns the body of the incoming POST content This is applicable for multipart form requests
 String getRequestContentType()
          Returns the content type of the incoming request
 String getRequestMethod()
          Returns the method of the incoming request
 Page getRootPage()
          Returns the root page for a site.
 WebFrameworkServiceRegistry getServiceRegistry()
          Returns the Web Framework services registry
 Configuration getSiteConfiguration()
          If the site has a configuration XML, then this will return it
 TemplateInstance getTemplate()
          Returns the current executing template.
 String getTemplateId()
          Returns the id of the currently executing template.
 Theme getTheme()
           
 String getThemeId()
          Returns the current theme id
 String getUri()
           
 User getUser()
          Returns the current user
 String getUserId()
          Returns the current user id
 Serializable getValue(String key)
          Retrieves a custom value from the request context
 Map<String,Serializable> getValuesMap()
          Returns the underlying map of the custom key/values pairs stored on this RequestContext instance.
 Map getViewModel()
          Returns the view model
 String getWebsiteTitle()
          Returns the title of the web site.
 boolean hasParameter(String key)
          Returns true if a parameter exists in the request context
 boolean hasValue(String key)
          Returns true if a custom value exists in the request context
 void release()
          Release any resources held by the request context As part of the contract for a RequestContext object, this will only ever be called once and no further method calls will be made to the RequestContext object.
 void removeValue(String key)
          Removes a custom value from the request context
 void setCurrentObject(Resource object)
          Sets the current object
 void setFormatId(String formatId)
          Sets the current format id
 void setModel(Model model)
          Sets the current model
 void setPage(Page page)
          Sets the currently executing page.
 void setRenderingComponent(Component component)
          Indicates that the given component is being rendered as part of the rendering execution for this and any parent rendering context.
 void setTemplate(TemplateInstance currentTemplate)
          Sets the current executing template.
 void setThemeId(String themeId)
          Sets the current theme id
 void setUri(String uri)
          Sets the currently executing uri.
 void setUser(User user)
          Sets the current user for this request
 void setValue(String key, Serializable value)
          Sets a custom attribute onto the request context
 void setViewModel(Map viewModel)
          Sets the view model
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WrappedRequestContext

public WrappedRequestContext(RequestContext context)
Method Detail

getOriginalContext

public final RequestContext getOriginalContext()

getId

public String getId()
Description copied from interface: RequestContext
Each request context instance is stamped with a unique id

Specified by:
getId in interface RequestContext
Returns:
The id of the request context

getSiteConfiguration

public Configuration getSiteConfiguration()
Description copied from interface: RequestContext
If the site has a configuration XML, then this will return it

Specified by:
getSiteConfiguration in interface RequestContext
Returns:
Configuration instance for the site

getWebsiteTitle

public String getWebsiteTitle()
Description copied from interface: RequestContext
Returns the title of the web site. This is drawn from the site configuration XML if available.

Specified by:
getWebsiteTitle in interface RequestContext
Returns:

getPageTitle

public String getPageTitle()
Description copied from interface: RequestContext
Returns the title of the current page. This is drawn from the current page instance, if set.

Specified by:
getPageTitle in interface RequestContext
Returns:
The title of the current page.

getUri

public String getUri()
Specified by:
getUri in interface RequestContext
Returns:
the currently executing uri.

setUri

public void setUri(String uri)
Description copied from interface: RequestContext
Sets the currently executing uri.

Specified by:
setUri in interface RequestContext

getPage

public Page getPage()
Description copied from interface: RequestContext
If a page instance is currently executing, it can be retrieved from the request context.

Specified by:
getPage in interface RequestContext
Returns:
The current page

setPage

public void setPage(Page page)
Description copied from interface: RequestContext
Sets the currently executing page.

Specified by:
setPage in interface RequestContext

getPageId

public String getPageId()
Description copied from interface: RequestContext
Returns the id of the currently executing page. If a currently executing page is not set, this will return null.

Specified by:
getPageId in interface RequestContext
Returns:
The current page id (or null)

getLinkBuilder

public LinkBuilder getLinkBuilder()
Description copied from interface: RequestContext
Returns the LinkBuilder to be used for the currently executing page. In general, you will have one link builder per site but this hook allows for the possibility of multiple.

Specified by:
getLinkBuilder in interface RequestContext
Returns:

getRootPage

public Page getRootPage()
Description copied from interface: RequestContext
Returns the root page for a site. A root page is designated if it either has a root-page property in its XML or the site configuration has specifically designated a root page.

Specified by:
getRootPage in interface RequestContext
Returns:
The root page of the application

getTemplate

public TemplateInstance getTemplate()
Description copied from interface: RequestContext
Returns the current executing template.

Specified by:
getTemplate in interface RequestContext
Returns:

setTemplate

public void setTemplate(TemplateInstance currentTemplate)
Description copied from interface: RequestContext
Sets the current executing template.

Specified by:
setTemplate in interface RequestContext

getTemplateId

public String getTemplateId()
Description copied from interface: RequestContext
Returns the id of the currently executing template. If no template is set, this will return null.

Specified by:
getTemplateId in interface RequestContext
Returns:
The current template id or null

getCurrentObjectId

public String getCurrentObjectId()
Description copied from interface: RequestContext
Returns the id of the current object If no object has been set, then the id will be null.

Specified by:
getCurrentObjectId in interface RequestContext
Returns:
The id of the current object

setCurrentObject

public void setCurrentObject(Resource object)
Description copied from interface: RequestContext
Sets the current object

Specified by:
setCurrentObject in interface RequestContext

getCurrentObject

public Resource getCurrentObject()
Description copied from interface: RequestContext
Returns the current object If no object has been set, then null is returned

Specified by:
getCurrentObject in interface RequestContext
Returns:
The current object

getFormatId

public String getFormatId()
Description copied from interface: RequestContext
Returns the current format id

Specified by:
getFormatId in interface RequestContext
Returns:

setFormatId

public void setFormatId(String formatId)
Description copied from interface: RequestContext
Sets the current format id

Specified by:
setFormatId in interface RequestContext

getModel

public Model getModel()
Description copied from interface: RequestContext
Returns the model. The model allows object model manipulation and persistence.

Specified by:
getModel in interface RequestContext
Returns:

setModel

public void setModel(Model model)
Description copied from interface: RequestContext
Sets the current model

Specified by:
setModel in interface RequestContext

setUser

public void setUser(User user)
Description copied from interface: RequestContext
Sets the current user for this request

Specified by:
setUser in interface RequestContext

getUser

public User getUser()
Description copied from interface: RequestContext
Returns the current user

Specified by:
getUser in interface RequestContext
Returns:

getUserId

public String getUserId()
Description copied from interface: RequestContext
Returns the current user id

Specified by:
getUserId in interface RequestContext
Returns:

getCredentialVault

public CredentialVault getCredentialVault()
Description copied from interface: RequestContext
Returns the credential vault

Specified by:
getCredentialVault in interface RequestContext
Returns:

getThemeId

public String getThemeId()
Description copied from interface: RequestContext
Returns the current theme id

Specified by:
getThemeId in interface RequestContext

setThemeId

public void setThemeId(String themeId)
Description copied from interface: RequestContext
Sets the current theme id

Specified by:
setThemeId in interface RequestContext

getTheme

public Theme getTheme()
Specified by:
getTheme in interface RequestContext
Returns:
the current Theme object or null if not set

getRequestContentType

public String getRequestContentType()
Description copied from interface: RequestContext
Returns the content type of the incoming request

Specified by:
getRequestContentType in interface RequestContext
Returns:
content type

getRequestMethod

public String getRequestMethod()
Description copied from interface: RequestContext
Returns the method of the incoming request

Specified by:
getRequestMethod in interface RequestContext
Returns:
request method

getRequestContent

public Content getRequestContent()
Description copied from interface: RequestContext
Returns the body of the incoming POST content This is applicable for multipart form requests

Specified by:
getRequestContent in interface RequestContext
Returns:
content

setValue

public void setValue(String key,
                     Serializable value)
Description copied from interface: RequestContext
Sets a custom attribute onto the request context

Specified by:
setValue in interface RequestContext

getValue

public Serializable getValue(String key)
Description copied from interface: RequestContext
Retrieves a custom value from the request context

Specified by:
getValue in interface RequestContext
Returns:

removeValue

public void removeValue(String key)
Description copied from interface: RequestContext
Removes a custom value from the request context

Specified by:
removeValue in interface RequestContext

hasValue

public boolean hasValue(String key)
Description copied from interface: RequestContext
Returns true if a custom value exists in the request context

Specified by:
hasValue in interface RequestContext
Returns:
true if a custom value exists in the request context

getValuesMap

public Map<String,Serializable> getValuesMap()
Description copied from interface: RequestContext
Returns the underlying map of the custom key/values pairs stored on this RequestContext instance. Use with caution!

Specified by:
getValuesMap in interface RequestContext
Returns:
the underlying map of custom key/value pairs.

getParameter

public Serializable getParameter(String key)
Description copied from interface: RequestContext
Retrieves a parameter from the request context

Specified by:
getParameter in interface RequestContext
Returns:

hasParameter

public boolean hasParameter(String key)
Description copied from interface: RequestContext
Returns true if a parameter exists in the request context

Specified by:
hasParameter in interface RequestContext
Returns:
true if a custom value exists in the request context

getParameters

public Map<String,Serializable> getParameters()
Description copied from interface: RequestContext
Returns a map of parameters

Specified by:
getParameters in interface RequestContext
Returns:
the underlying map of parameters

getViewModel

public Map getViewModel()
Description copied from interface: RequestContext
Returns the view model

Specified by:
getViewModel in interface RequestContext
Returns:
map of view model variables keyed by name

setViewModel

public void setViewModel(Map viewModel)
Description copied from interface: RequestContext
Sets the view model

Specified by:
setViewModel in interface RequestContext
Parameters:
viewModel - map

getRenderingComponents

public Component[] getRenderingComponents()
Description copied from interface: RequestContext
Returns the components that were bound to this and any of its parent context during the rendering. This is useful to determine what other components are configured on the current page. If no rendering components are set, null will be returned

Specified by:
getRenderingComponents in interface RequestContext
Returns:
An array of Component objects

setRenderingComponent

public void setRenderingComponent(Component component)
Description copied from interface: RequestContext
Indicates that the given component is being rendered as part of the rendering execution for this and any parent rendering context.

Specified by:
setRenderingComponent in interface RequestContext
Parameters:
component - The component that is being rendered

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Description copied from interface: RequestContext
Returns the HTTP Servlet Request bound to this request

Specified by:
getRequest in interface RequestContext
Returns:

release

public void release()
Description copied from interface: RequestContext
Release any resources held by the request context As part of the contract for a RequestContext object, this will only ever be called once and no further method calls will be made to the RequestContext object.

Specified by:
release in interface RequestContext

toString

public String toString()
Overrides:
toString in class Object

getServiceRegistry

public WebFrameworkServiceRegistry getServiceRegistry()
Description copied from interface: RequestContext
Returns the Web Framework services registry

Specified by:
getServiceRegistry in interface RequestContext
Returns:
services registry


Copyright © 2009 SpringSource, Inc. All Rights Reserved.