cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: CONTEXT_WORK_DIR from flowscript
Date Tue, 06 Mar 2007 11:30:22 GMT
Tobia wrote:
> Jeroen Reijn wrote:
>> after listing all the AttributeNames attached to the context you could
>> try to use the following line:
>>
>> print("workDir: " + 
>> cocoon.context.getAttribute("javax.servlet.context.tempdir"));
> 
> Thank you.  
> It turns out CONTEXT_WORK_DIR in the Avalon context is equivalent to:
> 
> cocoon.context.getAttribute('javax.servlet.context.tempdir') + 
> '/cocoon-files'
> 
> And that's where the various Lucene components create and look for
> indices by default.
> 
This is only true if you use the default configuration for the working
directory. However, it's possible to store the directory somewhere else.
The only way to get the Avalon Context in Flow is to write a Java class
that implements Contextualizable. You can now instantiate an object of
this class from flow through "cocoon.createObject("CLASSNAME");"
Cocoon calls the contextualize methods and passes in the Context object.
Store this in an instance variable and add a getter method to the
object, for example getAvalonContext(), then you get the context like
cocoon.createObject("CLASSNAME").getAvalonContext().

Now, this is rather complicated, I admit, but it should always work.

Carsten
-- 
Carsten Ziegeler
http://www.osoco.org/weblogs/rael/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message