org.apache.cocoon.spring.configurator
Class WebAppContextUtils

java.lang.Object
  extended byorg.apache.cocoon.spring.configurator.WebAppContextUtils

public abstract class WebAppContextUtils
extends Object

Utility class to manage hierarchical application contexts.

Since:
1.0
Version:
$Id: WebAppContextUtils.java 606207 2007-12-21 14:17:33Z vgritsenko $

Nested Class Summary
protected static class WebAppContextUtils.ContextInfo
          Private bean keeping track of the class loader and web application context.
 
Field Summary
static String CONTAINER_REQUEST_ATTRIBUTE
          The name of the request attribute containing the current bean factory.
 
Constructor Summary
WebAppContextUtils()
           
 
Method Summary
static Object enteringContext(WebApplicationContext webAppContext)
          Notify about entering this context.
static WebApplicationContext getCurrentWebApplicationContext()
          Get the current web application context.
protected static WebApplicationContext getCurrentWebApplicationContext(RequestAttributes attributes)
          Return the current web application context or if the attributes are null, the parent context.
static void leavingContext(WebApplicationContext webAppContext, Object handle)
          Notify about leaving this context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTAINER_REQUEST_ATTRIBUTE

public static final String CONTAINER_REQUEST_ATTRIBUTE
The name of the request attribute containing the current bean factory.

Constructor Detail

WebAppContextUtils

public WebAppContextUtils()
Method Detail

getCurrentWebApplicationContext

public static WebApplicationContext getCurrentWebApplicationContext()
Get the current web application context.

Returns:
The current web application context.
Throws:
IllegalStateException - if no WebApplicationContext could not be found

getCurrentWebApplicationContext

protected static WebApplicationContext getCurrentWebApplicationContext(RequestAttributes attributes)
Return the current web application context or if the attributes are null, the parent context.

Parameters:
attributes - The request attributes.
Returns:
The web application context.
Throws:
IllegalStateException - if no WebApplicationContext could not be found

enteringContext

public static Object enteringContext(WebApplicationContext webAppContext)
Notify about entering this context.

Parameters:
webAppContext - The current web application context.
Returns:
A handle which should be passed to leavingContext(WebApplicationContext, Object).

leavingContext

public static void leavingContext(WebApplicationContext webAppContext,
                                  Object handle)
Notify about leaving this context.

Parameters:
webAppContext - The current web application context.
handle - The returned handle from enteringContext(WebApplicationContext).


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