org.apache.cocoon.servlet.controller
Class ControllerContextHelper

java.lang.Object
  extended by org.apache.cocoon.servlet.controller.ControllerContextHelper

public final class ControllerContextHelper
extends Object

This class helps with storing and retrieving the controller context. Internally it uses the current servlet request. Thanks to the servlet-service framework, the current request becomes the parent of all sub-requests that use e.g. the 'servlet:' protocol. This means that it is enough to store objects that should be available in a sub-request into the current request.


Method Summary
static Map<String,Object> getContext(Map<String,? extends Object> parameters)
          Retrieve the current controller context from the Cocoon parameters.
static void storeContext(Map<String,Object> controllerContext, javax.servlet.http.HttpServletRequest request)
          Store the controller context (a Map directly into the HttpServletRequest.
static void storeContext(Map<String,Object> controllerContext, Map<String,Object> parameters)
          Store the controller context (a Map) in the Cocoon parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getContext

public static Map<String,Object> getContext(Map<String,? extends Object> parameters)
Retrieve the current controller context from the Cocoon parameters.

Parameters:
parameters - The Cocoon parameters map.
Returns:
The controller context map as being available in the current servlet request.

storeContext

public static void storeContext(Map<String,Object> controllerContext,
                                Map<String,Object> parameters)
Store the controller context (a Map) in the Cocoon parameters.

Parameters:
controllerContext - The objects that should be available in the child request.
parameters - The Cocoon parameters map.

storeContext

public static void storeContext(Map<String,Object> controllerContext,
                                javax.servlet.http.HttpServletRequest request)
Store the controller context (a Map directly into the HttpServletRequest.

Parameters:
controllerContext - The objects that should be available in the child request.
request - The current request that becomes the parent of the next request.


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.