info.magnolia.context
Interface WebContext

All Superinterfaces:
org.apache.commons.chain.Context, java.util.Map
All Known Implementing Classes:
WebContextImpl

public interface WebContext
extends Context

Context interface specialized for servlet requests; knows about HttpServletRequest/HttpServletResponse.

Version:
$Revision: 36506 $ ($Author: had $)
Author:
Philipp Bracher

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static java.lang.String ATTRIBUTE_REQUEST_CHARACTER_ENCODING
          Deprecated. use AggregationState
static java.lang.String ATTRIBUTE_REQUEST_URI
          Deprecated. use AggregationState
 
Fields inherited from interface info.magnolia.context.Context
APPLICATION_SCOPE, ATTRIBUTE_COMMENT, ATTRIBUTE_EXCEPTION, ATTRIBUTE_MESSAGE, ATTRIBUTE_PATH, ATTRIBUTE_RECURSIVE, ATTRIBUTE_REPOSITORY, ATTRIBUTE_UUID, ATTRIBUTE_VERSION, ATTRIBUTE_VERSION_MAP, LOCAL_SCOPE, SESSION_SCOPE
 
Method Summary
 AggregationState getAggregationState()
          Retrieves the Aggregator instance, which gathers all info regarding the current request (paths, etc).
 java.lang.String getContextPath()
          Get the current context path.
 javax.servlet.jsp.PageContext getPageContext()
          Returns the current jsp page context, if any.
 java.lang.String getParameter(java.lang.String name)
          Get a parameter value as string.
 java.util.Map<java.lang.String,java.lang.String> getParameters()
          Get all parameter values as a Map<String, String>.
 java.lang.String[] getParameterValues(java.lang.String name)
          Get parameter values as string[].
 MultipartForm getPostedForm()
          Get form object assembled by MultipartRequestFilter.
 javax.servlet.http.HttpServletRequest getRequest()
          Avoid calls to this method wherever possible.
 javax.servlet.http.HttpServletResponse getResponse()
          Avoid depending on this as much as possible.
 javax.servlet.ServletContext getServletContext()
          Returns the current servlet context.
 void include(java.lang.String path, java.io.Writer out)
          Includes/render the given path into the given Writer, by wrapping it in the current HttpServletResponse.
 void init(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
          Method used to initialize the context.
 void pop()
           
 void push(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void resetAggregationState()
          Resets the current aggregator instance.
 void setPageContext(javax.servlet.jsp.PageContext pageContext)
          Sets the current jsp page context.
 
Methods inherited from interface info.magnolia.context.Context
getAccessManager, getAccessManager, getAttribute, getAttribute, getAttributes, getAttributes, getHierarchyManager, getHierarchyManager, getLocale, getMessages, getMessages, getQueryManager, getQueryManager, getUser, release, removeAttribute, setAttribute, setLocale
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Field Detail

ATTRIBUTE_REQUEST_CHARACTER_ENCODING

static final java.lang.String ATTRIBUTE_REQUEST_CHARACTER_ENCODING
Deprecated. use AggregationState
Attribute name to get the requests character encoding.

See Also:
Constant Field Values

ATTRIBUTE_REQUEST_URI

static final java.lang.String ATTRIBUTE_REQUEST_URI
Deprecated. use AggregationState
Attribute name to get the request uri.

See Also:
Constant Field Values
Method Detail

init

void init(javax.servlet.http.HttpServletRequest request,
          javax.servlet.http.HttpServletResponse response,
          javax.servlet.ServletContext servletContext)
Method used to initialize the context.


getAggregationState

AggregationState getAggregationState()
Retrieves the Aggregator instance, which gathers all info regarding the current request (paths, etc).


resetAggregationState

void resetAggregationState()
Resets the current aggregator instance.


getPostedForm

MultipartForm getPostedForm()
Get form object assembled by MultipartRequestFilter.

Returns:
multipart form object

getParameter

java.lang.String getParameter(java.lang.String name)
Get a parameter value as string.

Returns:
parameter value

getParameters

java.util.Map<java.lang.String,java.lang.String> getParameters()
Get all parameter values as a Map<String, String>.

Returns:
parameter values

getContextPath

java.lang.String getContextPath()
Get the current context path.


getRequest

javax.servlet.http.HttpServletRequest getRequest()
Avoid calls to this method wherever possible.

Returns:
Returns the request.

getResponse

javax.servlet.http.HttpServletResponse getResponse()
Avoid depending on this as much as possible.


getServletContext

javax.servlet.ServletContext getServletContext()
Returns the current servlet context.

Returns:
ServletContext instance

include

void include(java.lang.String path,
             java.io.Writer out)
             throws javax.servlet.ServletException,
                    java.io.IOException
Includes/render the given path into the given Writer, by wrapping it in the current HttpServletResponse.

Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
ServletRequest.getRequestDispatcher(String), RequestDispatcher.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse)

setPageContext

void setPageContext(javax.servlet.jsp.PageContext pageContext)
Sets the current jsp page context. Callers should take care of appropriately unset it once done with it. Typically a jsp renderer will setPageContext(null) after having rendered a jsp.

Parameters:
pageContext - jsp page context

getPageContext

javax.servlet.jsp.PageContext getPageContext()
Returns the current jsp page context, if any.

Returns:
jsp page context or null if it has not been populated by calling setPageContext

push

void push(javax.servlet.http.HttpServletRequest request,
          javax.servlet.http.HttpServletResponse response)
Parameters:
request -
response -

pop

void pop()

getParameterValues

java.lang.String[] getParameterValues(java.lang.String name)
Get parameter values as string[].

Returns:
parameter values


Copyright © 2003-2010 Magnolia International Ltd.. All Rights Reserved.