cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r688560 - /cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
Date Sun, 24 Aug 2008 20:55:00 GMT
Author: reinhard
Date: Sun Aug 24 13:55:00 2008
New Revision: 688560

URL: http://svn.apache.org/viewvc?rev=688560&view=rev
Log:
make sitemap path configureable

Modified:
    cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java

Modified: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java?rev=688560&r1=688559&r2=688560&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
Sun Aug 24 13:55:00 2008
@@ -209,7 +209,7 @@
             try {
                 SitemapBuilder sitemapBuilder = (SitemapBuilder) this.beanFactory.getBean(SitemapBuilder.class
                         .getName());
-                URL url = servletConfig.getServletContext().getResource("/sitemap.xmap");
+                URL url = servletConfig.getServletContext().getResource(this.getSitemapPath());
                 this.sitemap = sitemapBuilder.build(url);
             } catch (Exception e) {
                 String msg = "An exception occurred while building the sitemap.";
@@ -220,4 +220,17 @@
             this.initialized = true;
         }
     }
+
+    private String getSitemapPath() {
+        String sitemapPath = this.getInitParameter("sitemap-path");
+        if (sitemapPath == null) {
+            sitemapPath = "/sitemap.xmap";
+        }
+
+        if (!sitemapPath.startsWith("/")) {
+            sitemapPath = "/" + sitemapPath;
+        }
+
+        return sitemapPath;
+    }
 }



Mime
View raw message