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:
http://wiki.apache.org/cocoon/SitemapURIModule

------------------------------------------------------------------------------
+ __NOTE: This module is no longer of any use. Please use the 
[:EnvironmentInputModule] described at the end of this document__
+ 
  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 
[http://www.rabellino.it/blog/index.php?title=things_to_remember_for_the_next_cocoon_p&more=1&c=1&tb=1&pb=1]:
@@ -37, +39 @@

    "/a/b/c/d" - "e" = ???
  
  As far as I can see, this is not easily solved in the input module itself.
- However, the sitemap-base-URI is available internally in the 
(Http)Environment of the (Http)Request, through the getURIPrefix() method. All 
that is needed is to make this available. I will try to do that, and tell about 
it here - and submit a patch if I am successful.
+ However, the sitemap-base-URI is available internally in the 
(Http)Environment of the (Http)Request, through the getURIPrefix() method.
  
+ == EnvironmentInputModule ==
+ 
+ The sitemap URIPrefix (base-sitemap-URI) is available in the Cocoon 
environment. However, as of 2.1.7 there is no standard input module to access 
it.
+ The following code fixes this, and will be submitted to the buglist.
+ 
+ {{{
+ package org.apache.cocoon.components.modules.input;
+ 
+ import java.util.Map;
+ 
+ import org.apache.avalon.framework.configuration.Configuration;
+ import org.apache.cocoon.components.CocoonComponentManager;
+ import org.apache.cocoon.environment.Environment;
+ 
+ /**
+  * The EnvironmentInputModule accesses properties of the current environment 
using JXPath syntax.
+  * These properties are: URI, URIPrefix, action, context, rootContext, view.
+  * @see org.apache.cocoon.environment.Environment
+  */
+ 
+ public class EnvironmentInputModule extends AbstractJXPathModule {
+ 
+   protected Object getContextObject(Configuration modeConf, Map objectModel) {
+     Environment env = CocoonComponentManager.getCurrentEnvironment();
+     return env;
+   }
+ 
+ }
+ }}}
+