You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Klotz <pk...@iconet.wn.bawue.de> on 2003/04/03 13:03:03 UTC

Getting context and work directory in SourceFactory or Action

Hi,

it looks like a Action or SourceFactory cannot be Contextualizable?
I want to get the context directory of the webapp or the Cocoon work
directory. I though that in order to get that I let the Action and the
SourceFactory implement Contextualizable and then with

 workDir = (File)context.get(Constants.CONTEXT_WORK_DIR)
 contextDir = (File)context.get(Constants.DEFAULT_CONTEXT_DIR)

But I'm not sure with the second one whether that is really the right
constant. In a SourceFactory I get a error with this. A Source cannot be
contextualizable at least it never gets called it seems.

I saw in another mail that for actions there is a possibility to get the
context directory (is equal to "real path"???) from the object model. But
in a SoureFactory I don't have that.

Context context = ObjectModelHelper.getContext(objectModel);
String fileName = context.getRealPath("/myfile.xsd");

So how is it supposed to work?
Must be something everybody needs in order to access files from a source
or action, so please share your knowledge.

BTW, using Cocoon 2.0.4.


Thanks, Peter



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