Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 1437 invoked from network); 11 Aug 2004 14:15:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Aug 2004 14:15:14 -0000 Received: (qmail 87494 invoked by uid 500); 11 Aug 2004 14:15:09 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 87438 invoked by uid 500); 11 Aug 2004 14:15:08 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 87425 invoked by uid 99); 11 Aug 2004 14:15:08 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received: from [212.131.130.82] (HELO mail.cbim.it) (212.131.130.82) by apache.org (qpsmtpd/0.27.1) with ESMTP; Wed, 11 Aug 2004 07:15:05 -0700 Received: from cuprouter.cbim.it (cuprouter.cbim.it [192.168.4.10]) by mail.cbim.it (8.11.6/8.11.0) with ESMTP id i7BEkQQ02976 for ; Wed, 11 Aug 2004 16:46:26 +0200 Received: from cbim.it (caterina.cbim.it [192.168.4.42]) by cuprouter.cbim.it (8.9.3/8.9.3) with ESMTP id QAA04687 for ; Wed, 11 Aug 2004 16:15:57 +0200 Message-ID: <411A29E7.2070602@cbim.it> Date: Wed, 11 Aug 2004 16:15:03 +0200 From: Ugo Cei Organization: C.B.I.M. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040116 X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: Spring integration: accessing servlet context References: <4107656E.3040404@mobilebox.pl> In-Reply-To: <4107656E.3040404@mobilebox.pl> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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