You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Leo Sutic <le...@inspireinfrastructure.com> on 2001/08/31 13:58:34 UTC

[Patch][C2.0/2.1] Sitemap class name conflict. Bug?

All,

the sitemap.xmap file always compiles to org.apache.cocoon.www.sitemap_xmap,
unless one has specified a different root package in cocoon.xconf. Thus, to
run two cocoon webapps, one must specify different root packages for the
program generator in cocoon.xconf. This makes deployment of multiple cocoon
webapps on one server difficult.

Since I am about to be responsible for multiple cocoon webapps not written
nor maintained by me running on one server, I want to avoid the issue
altogether and extend the root package with the context directory name, with
'/', '\', and ':' replaced by '_'.

I have tried with the ParanoidCocoonServlet, as well as setting
init-classloader to true in web.xml and selecting different work
directories. Nothing worked.

/LS

Patch follows:

--- ProgramGeneratorImpl_orig_0.java  Fri Aug 31 13:49:34 2001
+++
org\apache\cocoon\components\language\generator\ProgramGeneratorImpl.java
Fri Aug 31 13:46:18 2001
@@ -130,6 +130,18 @@
         Parameters params = Parameters.fromConfiguration(conf);
         this.autoReload = params.getParameterAsBoolean("auto-reload",
autoReload);
         this.rootPackage = params.getParameter("root-package",
"org.apache.cocoon.www");
+
+        //
+        // Ensure unique root packages for each context directory
+        //
+        String packageSuffix = this.contextDir.replace(':', '_');
+        packageSuffix = packageSuffix.replace('/', '_');
+        packageSuffix = packageSuffix.replace('\\', '_');
+        getLogger().debug("Package suffix is " + packageSuffix);
+
+        this.rootPackage = this.rootPackage + "." + packageSuffix;
+        getLogger().debug("Root package is " + rootPackage);
+
         this.preload = params.getParameterAsBoolean("preload", preload);
     }



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