info.magnolia.context
Interface WebContext

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

public interface WebContext
extends Context

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

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static String ATTRIBUTE_REQUEST_CHARACTER_ENCODING
          Deprecated. use AggregationState
static 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).
 String getContextPath()
          Get the current context path.
 javax.servlet.jsp.PageContext getPageContext()
          Returns the current jsp page context, if any.
 String getParameter(String name)
          Get a parameter value as string.
 Map<String,String> getParameters()
          Get all parameter values as a Map<String, String>.
 String[] getParameterValues(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(String path, 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, getAttribute, getAttribute, getAttributes, getAttributes, getHierarchyManager, getJCRSession, getLocale, getMessages, getMessages, getQueryManager, getSubject, 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 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 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

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

Returns:
parameter value

getParameters

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

Returns:
parameter values

getContextPath

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(String path,
             Writer out)
             throws javax.servlet.ServletException,
                    IOException
Includes/render the given path into the given Writer, by wrapping it in the current HttpServletResponse.

Throws:
javax.servlet.ServletException
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

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

Returns:
parameter values


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