cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Cocoon Wiki] Update of "SitemapURIModule" by NicoVerwer
Date Tue, 14 Jun 2005 21:02:37 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cocoon Wiki" for change notification.

The following page has been changed by NicoVerwer:

The comment on the change is:
Just added it.

New page:

This is an input module that determines the absolute URI to the base of the sitemap.
It can help you to make your Cocoon application relocatable.
The problem with this was described by Gianugo []:

  Always take relocability of your Cocoon application into account, from the very beginning
of your project. Your application should work from the webapp root (mounted as /), under a
context path (/whatever) or as a sub-sitemap (/whatever/the/user/wants). This means that you
should always pass a "mount-point" attribute within your rendering pipelines and components,
calculating where your application has been mounted, and building paths accordingly. Unfortunately
the current Cocoon API will only tell you the full request path and the URI handled by the
sitemap, so you need to mangle those data by substracting (string-wise) the sitemap URI from
the request URI in order to obtain the path you're looking for. That is, if your sitemap is
mounted on /context/foo and your request is for /context/foo/bar/baz, the sitemap URI will
be bar/baz, while the data you need is actually /context/foo to build your links properly.

The SitemapURIModule takes care of the calculation mentioned in the quotation.

Thus, if you use `{sitemap-uri:}`, it will be substituted by `/whatever/` or `/whatever/the/user/wants/`.
You can append a relative URI within the sitemap, as in `{sitemap-uri:you/like}`, which gives

The code for this input module is attached to this page (see 'attachments' under 'more actions').

View raw message