Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 73001 invoked by uid 500); 22 Mar 2002 16:10:34 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 72925 invoked from network); 22 Mar 2002 16:10:33 -0000 From: "Vadim Gritsenko" To: Subject: RE: Adding values to Cocoon's context Date: Fri, 22 Mar 2002 11:09:41 -0500 Message-ID: <001401c1d1bb$f959b560$0a00a8c0@vgritsenkopc> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 In-Reply-To: <20020322155022.GA8598@fztig938.bank.dresdner.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N > From: Marcus Crafter [mailto:crafterm@fztig938.bank.dresdner.net] > > Hi All, > > Hope all is well. I need some advice! :) > > In my quest to avalonize and cocoonize our application, I've > come up against a problem. > > From what I can see, it's not possible to add context key/values to > the cocoon context from a servlet subclass for thread safe components. > > Threadsafe component instances are created by the ECM during > Cocoon's startup in CocoonServlet.init(). If one wants to modify > CocoonServlet.appContext in a servlet subclass (using values > from init-param's, etc) then CocoonServlet.init() has to be > called before the subclass does any work. > > This means, thread safe components that implement Contextualizable > won't be able to find any context values they need. > > What am I trying to do ? Store values in the Cocoon context that are > global across all components. > > I've found several solutions: > > 1. make CocoonServlet.createCocoon() protected, allowing a > subclass to override it, accessing the appContext before the Cocoon > instance is created. > > 2. make it possible to defer the creation of the Cocoon > instance. eg. add an init-param 'create-cocoon-at-startup' which > will specify whether the Cocoon instance will be created in > CocoonServlet.init(), or at first request (or by a subclass). > This allows a subclass to add values to the cocoon context > during subclass.init(). > > 3. incorporate Wolfram Eiserts Avalon scratchpad ContextUtility > class which allows one to specify a .. tag > set in cocoon.xconf that automatically populates the Cocoon context > with globals. More info under > http://marc.theaimsgroup.com/?l=avalon-dev&m=101559574528413&w=2 > > 4. any others ? Here it is: Write another servlet populating context and set startup order in the web.xml so it is initialized before Cocoon servlet. Vadim > I've tried other combinations of solutions (eg. parent component > manager), but they all have other problematic issues. :( > > I've implemented all 3 options, but are wondering what everyone > else thinks or if there is an easier way ? > > Any thoughts ? > > Cheers, > > Marcus > > -- > ..... > ,,$$$$$$$$$, Marcus Crafter > ;$' '$$$$: Computer Systems Engineer > $: $$$$: ManageSoft GmbH > $ o_)$$$: 82-84 Mainzer Landstrasse > ;$, _/\ &&:' 60327 Frankfurt Germany > ' /( &&& > \_&&&&' > &&&&. > &&&&&&&: --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org