You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ugo Cei <u....@cbim.it> on 2004/02/19 18:19:11 UTC

Bug in cocoon.context.getInitParameter?

I have this in my web.xml:

     <init-param>
       <param-name>index-directory</param-name>
       <param-value>/tmp/lucene</param-value>
     </init-param>

and this in my flowscript:

print("Index dir = " +
   cocoon.context.getInitParameter("index-directory"));

and it prints:

Index dir = null

Is this a bug or am I missing something obvious?

	TIA,

		Ugo



Re: Bug in cocoon.context.getInitParameter?

Posted by Upayavira <uv...@upaya.co.uk>.
Sylvain Wallez wrote:

> Ugo Cei wrote:
>
>> I have this in my web.xml:
>>
>>     <init-param>
>>       <param-name>index-directory</param-name>
>>       <param-value>/tmp/lucene</param-value>
>>     </init-param>
>>
>> and this in my flowscript:
>>
>> print("Index dir = " +
>>   cocoon.context.getInitParameter("index-directory"));
>>
>> and it prints:
>>
>> Index dir = null
>>
>> Is this a bug or am I missing something obvious?
>
>
>
> Yep: I guess you added <init-param> to the Cocoon *servlet* and not to 
> the *context* ;-)

Huh? So the init-params for the servlet in web.xml are different from 
the init-params in the context? Where do the context ones come from?

Regards, Upayavira



Re: Bug in cocoon.context.getInitParameter?

Posted by Ugo Cei <u....@cbim.it>.
Sylvain Wallez wrote:
> Yep: I guess you added <init-param> to the Cocoon *servlet* and not to 
> the *context* ;-)

Ah, I see. So how do you access a servlet parameter from flowscript or, 
more generally, what would be the best way to access runtime 
configuration parameters, without implementing a Configurable or 
Parametrizable Avalon component?

	Ugo



Re: Bug in cocoon.context.getInitParameter?

Posted by Sylvain Wallez <sy...@apache.org>.
Ugo Cei wrote:

> I have this in my web.xml:
>
>     <init-param>
>       <param-name>index-directory</param-name>
>       <param-value>/tmp/lucene</param-value>
>     </init-param>
>
> and this in my flowscript:
>
> print("Index dir = " +
>   cocoon.context.getInitParameter("index-directory"));
>
> and it prints:
>
> Index dir = null
>
> Is this a bug or am I missing something obvious?


Yep: I guess you added <init-param> to the Cocoon *servlet* and not to 
the *context* ;-)

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com