Giacomo Pati wrote:
Stefano Mazzocchi wrote:
Giacomo Pati wrote:
Hello all
I'd like to deprecate the RealPathModule in favor of the
ContextPathModule as all the RealPathModule can do is doable with the
ContextPathModule (but not 100% backward compatible) but the
ContextPathModule fits better in the Cocoon machinery as described in
my commit/javadocs.
Any suggestions/opinions?
Can you give us an example of why this is needed? I'm not sure I fully
get it from your log comment.
Ok, Suppose the following:
Your Cocoon app is at: /home/stefano/my-app
It contains a sitemap.xmap, an images directory and a xml2fo.xsl
Your COCOON_HOME is at /home/stefano/cocoon
You have a entry in $COCOON_HOME/mount-table.xml that looks like this:
<mount src="/home/stefano/my-app/" uri-prefix="fancy/"/>
Suppose your cocoon app produces fancy PDF files with graphics you have
at /home/stefano/my-app/images. The src attribute in fo:external-graphic
for FOP needs absolute paths to the image, so you need a way to pass it
to your FO producing XSL. But how do you supply your XSL with the path
to /home/stefano/my-app/images ?
Usually you pass the path as a parameter in your sitemaps map:transform
element. But with the current RealPathModule:
A {realpath:/} will give you
-> /home/stefano/cocoon/build/webapp
A {realpath:.} will give you
-> /home/stefano/cocoon/build/webapp
A {realpath:/fancy} will give you
-> /home/stefano/cocoon/build/webapp/fancy
which obviously is not what you wanted.
So, the ContextPathModule compared to the above will have
{contextpath:/} -> /home/stefano/cocoon/build/webapp
{contextpath:.} -> /home/stefano/my-app
{contextpath:/fancy} -> /home/stefano/my-app
{contextpath:./images} -> /home/stefano/my-app/images
For development mounting an app outside the COCOON_HOME is very handy.
Just change a xslt and reload to see the result once your app is mounted.
Is this explained enough :-)
It really shows how badly we need blocks ;-)
Anyway +1 for this.
--
Stefano.