Not sure exactly which path the OP wants, but look also at the ContextPath module:

http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/ modules/input/ContextPathModule.html

ContextPathModule provides a real filesystem path for a virtual context-relative path. If this mapping cannot be performed (e.g. Cocoon is running in a .war file), null will be returned. Compared to the RealPathModule this module is able to provide the "real" absolute path even if the application is mounted outside the webapp tree of Cocoon.

Note: the primary use for this is to support external code that wants a filesystem path. For example, The FOP 0.20.x serializer doesn't like relative image paths, and doesn't understand Cocoon URLs (context:, cocoon: etc). So we pass the *2fo.xsl stylesheet a real filesystem path to where we keep our images:

A absolute path argument like {contextpath:/resources} will be resolved from the root context path (ie. COCOON_HOME/build/webapp) whereas a relative path attribute like {contextpath:./resources} will be resolved from the location of the sitemap that uses it. If that sitemap is mounted outside the usual COCOON_HOME/build/webapp the path resolved with this modules points to the correct location.

So, for example, if I add a line for {realpath:./sitemap.xmap} to the cocoon samples sitemap for the
realpath module, I get:


./sitemap.xmap /usr/local/java/jakarta-tomcat-5.0.28/webapps/cocoon/./ sitemap.xmap

which points to the root cocoon sitemap. If I change that to {contextpath:./sitemap.xmap},
I get the sitemap for the current request:


./sitemap.xmap /usr/local/java/jakarta-tomcat-5.0.28/webapps/cocoon/ samples/modules/./sitemap.xmap


So if you want to pass the path for a work or temp directory that is in your project, use contextpath: -- it will work even if your project is mounted outside of cocoon.


[ Without getting into the history of how these things grew, I'm not sure why there should even be two different modules here. And the naming makes it even more confusing, since you expect that something called RealPathModule would actually give you a "real" path! ]


-- Steve Majewski / UVA Alderman Library


On May 1, 2007, at 4:16 PM, Alexander Daniel wrote:

The RealPath input module provides the functionality you are looking for. For more information see - http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/ modules/input/RealPathModule.html - If you have installed the standard Cocoon 2.1.10 distribution in Tomcat: http://localhost:8080/cocoon/samples/modules/realpath.html

Alex

On 01.05.2007, at 20:16, rachid harradi wrote:

hello together,

i have a question about getting path in javaflow or flowscript.

i produce many documents in cocoonApplication i will save it in any filesystem. i have the relativ from filesystem

is a possible to get any Context from tomcat server.xml like

<Context path"/name" docbas="z:/.../name" ..>

in cocoonApplication?



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to