cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Crafter <craft...@fztig938.bank.dresdner.net>
Subject Re: Adding values to Cocoon's context
Date Fri, 22 Mar 2002 16:51:29 GMT
On Fri, Mar 22, 2002 at 07:39:18PM +0300, Piroumian, Konstantin wrote:
 
> I think that he meant the usual servlet context, not appContext from
> CocoonServlet. You can add anything you need to your application context
> using another servlet, then CocoonServlet will already have all the needed
> data there on its load time.

	Ok. I understand. I thought he mean't the appContext. It's not really
	that elegant though, as it involves a 2 stage process to get
	values:

	public void contextualize(Context context)
	{
		o.a.c.e.Context ctx =
			(o.a.c.e.Context) context.get(
				Constants.CONTEXT_ENVIRONMENT_CONTEXT
			);

		myvalue = (String) ctx.getAttribute(SOME_VALUE);
	}

	compared to:

	public void contextualize(Context context)
	{
		myvalue = (String) context.get(SOME_VALUE);
	}

	I like the 1-liner better, especially since this will be in
	application code.

	CocoonServlet.appContext has protected access, so someone have thought
	about sharing it to subclasses - shouldn't we make this work for
	all types of avalon components ?

	Or have I missed something again! :-)

	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


Mime
View raw message