cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject Re: Spring integration: accessing servlet context
Date Wed, 11 Aug 2004 14:15:03 GMT
Leszek Gawron wrote:
> When integrating web application with Spring one needs to use 
> org.springframework.web.context.ContextLoaderListener. This listener 
> registers spring ApplicationContext in web application's servlet context.
> 
> In the application you fetch spring application context via:
> 
> org.springframework.web.context.support.WebApplicationContextUtils
>      .getWebApplicationContext(javax.servlet.ServletContext sc)
> 
> The problem is: how can I get access to cocoon's bare servlet context (I 
> know that breaks the abstraction but who cares)?
> 
> Or how can I implement this functionality without direct acces to 
> ServletContext (WebApplicationContextUtils source):

// Forgetting exception handling for the moment ...

importClass(Packages.org.springframework.web.context.WebApplicationContext);

function appCtxTest() {
     var appCtx = 
cocoon.context.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
     print(appCtx);
}


	Ugo

Mime
View raw message