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

Reply via email to