You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2006/04/18 22:14:21 UTC

svn commit: r395022 - in /cocoon/trunk/core/cocoon-core: COB-INF/sitemap.xmap COB-INF/sub/ COB-INF/sub/sitemap.xmap COB-INF/sub/test.xml src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java

Author: reinhard
Date: Tue Apr 18 13:14:19 2006
New Revision: 395022

URL: http://svn.apache.org/viewcvs?rev=395022&view=rev
Log:
fix sitemap servlet to strip leading slashes from uris; add sample that uses sub sitemaps

Added:
    cocoon/trunk/core/cocoon-core/COB-INF/sub/
    cocoon/trunk/core/cocoon-core/COB-INF/sub/sitemap.xmap
    cocoon/trunk/core/cocoon-core/COB-INF/sub/test.xml
Modified:
    cocoon/trunk/core/cocoon-core/COB-INF/sitemap.xmap
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java

Modified: cocoon/trunk/core/cocoon-core/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/COB-INF/sitemap.xmap?rev=395022&r1=395021&r2=395022&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/COB-INF/sitemap.xmap (original)
+++ cocoon/trunk/core/cocoon-core/COB-INF/sitemap.xmap Tue Apr 18 13:14:19 2006
@@ -18,13 +18,16 @@
 
   <map:pipelines>
     <map:pipeline>
-      <map:match pattern="test">
+      <map:match pattern="">
         <map:generate src="test.xml"/>
         <map:serialize type="xml"/>
-      </map:match>
-      <map:match pattern="test1">
+      </map:match>      
+      <map:match pattern="test">
         <map:generate src="test.xml"/>
         <map:serialize type="xml"/>
+      </map:match>
+      <map:match pattern="*/**">
+      	<map:mount src="{1}/" uri-prefix="{1}"/>
       </map:match>      
     </map:pipeline>
   </map:pipelines>

Added: cocoon/trunk/core/cocoon-core/COB-INF/sub/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/COB-INF/sub/sitemap.xmap?rev=395022&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-core/COB-INF/sub/sitemap.xmap (added)
+++ cocoon/trunk/core/cocoon-core/COB-INF/sub/sitemap.xmap Tue Apr 18 13:14:19 2006
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+  <map:pipelines>
+    <map:pipeline>
+      <map:match pattern="test">
+        <map:generate src="test.xml"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      <map:match pattern="">
+        <map:generate src="test.xml"/>
+        <map:serialize type="xml"/>
+      </map:match>      
+    </map:pipeline>
+  </map:pipelines>
+
+</map:sitemap>
+

Added: cocoon/trunk/core/cocoon-core/COB-INF/sub/test.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/COB-INF/sub/test.xml?rev=395022&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-core/COB-INF/sub/test.xml (added)
+++ cocoon/trunk/core/cocoon-core/COB-INF/sub/test.xml Tue Apr 18 13:14:19 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<test>OSGi: subsitemap</test>
\ No newline at end of file

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java?rev=395022&r1=395021&r2=395022&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java Tue Apr 18 13:14:19 2006
@@ -128,6 +128,11 @@
     		HttpServletResponse res) throws IOException  {
     	
 		String uri = req.getPathInfo();
+		if(uri != null) {
+			uri = uri.substring(1);
+		} else {
+			uri = "";
+		}
 
 		String formEncoding = req.getParameter("cocoon-form-encoding");
 		if (formEncoding == null) {