You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/02/12 23:06:28 UTC

svn commit: r627146 - /lenya/sandbox/modules/docustyle/sitemap.xmap

Author: andreas
Date: Tue Feb 12 14:06:25 2008
New Revision: 627146

URL: http://svn.apache.org/viewvc?rev=627146&view=rev
Log:
Moving sitemap from docu pub to docustyle module to avoid deploying after each change.

Added:
    lenya/sandbox/modules/docustyle/sitemap.xmap

Added: lenya/sandbox/modules/docustyle/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/docustyle/sitemap.xmap?rev=627146&view=auto
==============================================================================
--- lenya/sandbox/modules/docustyle/sitemap.xmap (added)
+++ lenya/sandbox/modules/docustyle/sitemap.xmap Tue Feb 12 14:06:25 2008
@@ -0,0 +1,269 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: sitemap.xmap 590726 2007-10-31 15:55:12Z nettings $ -->
+
+
+<!-- ============ cruft removal project: ================
+  
+  lenyabody-**  is only used internally in this sitemap and could be refactored without side effects.
+  currently we use lenyabody-raw-[edit|view], lenyabody-[edit|view], and now also document-content.
+  i'm sure this can be simplified.
+  
+-->
+
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  
+  <map:components>
+    <map:transformers default="xslt">
+      <map:transformer name="metaData" logger="lenya.sitemap.transformer.metaData" src="org.apache.lenya.cms.cocoon.transformation.MetaDataTransformer"/>
+    </map:transformers>
+    <map:serializers default="xhtml">
+      <map:serializer logger="sitemap.serializer.links" name="links" src="org.apache.lenya.cms.cocoon.serialization.LinkSerializer"/>
+    </map:serializers>
+  </map:components>
+  
+  <map:pipelines>
+    
+    <!-- This pipeline handles helper requests and metadata, not the actual publication documents -->
+    <map:pipeline>
+      
+      <!-- FIXME: this should be merged with the getDoctypeXSLT/* matcher below. currently, it is necessary
+        so that "getDoctypeXSLT/" requests do not get eaten by the **/ matcher below. 
+        Plus it should be moved to an internal-only pipeline.
+      -->
+      <map:match pattern="getDoctypeXSLT/">
+        <map:generate src="fallback://lenya/modules/docustyle/xslt/page2xhtml.xsl"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <!-- Redirect to "About" page. -->
+      <map:match pattern="*/">
+        <map:redirect-to uri="{proxy:/{page-envelope:publication-id}/{1}/project-information/indexpm.html}"/>
+      </map:match>
+      <map:match pattern="*">
+        <map:redirect-to uri="{proxy:/{page-envelope:publication-id}/{1}/project-information/indexpm.html}"/>
+      </map:match>
+      
+      <!-- Requests ending in a slash are redirected to the corresponding index.html page to mimic
+        standard web browser behaviour. -->
+      <!-- FIXME: this will trigger a HTTP redirect. Maybe it's more effective to do an internal redirect using
+        a cocoon:/ URI? An apache httpd server will not send a HTTP redirect when a directory is requested, but
+        serve the index.html file implicitly IIRC. -->
+      <map:match pattern="**/">
+        <map:redirect-to uri="index.html"/>
+      </map:match>
+      
+    </map:pipeline>
+    
+    
+    <map:pipeline type="caching">
+      
+      <!-- {1:rendertype}/{2:pub}/{3:area}/{4:path} -->
+      <map:match pattern="document-content/*/*/*/**">
+        <map:act type="language-exists">
+          <map:generate src="{resource-type:format-xhtml}?rendertype={../1}"/>
+          <map:serialize type="xml"/>
+        </map:act>
+        <!-- if the action fails (i.e. the document does not exist), create a nice error page. -->
+        <map:generate type="serverpages" src="fallback://lenya/content/exception/document-does-not-exist.xsp"/>
+        <map:transform src="fallback://lenya/xslt/exception/document-does-not-exist.xsl">
+          <map:parameter name="requestUrl" value="{request:requestURI}"/>
+          <map:parameter name="contextPath" value="{request:contextPath}"/>
+          <map:parameter name="pub" value="{2}"/>
+          <map:parameter name="path" value="/{4}"/>
+          <map:parameter name="area" value="{3}"/>
+        </map:transform>
+        <map:transform type="i18n">
+          <map:parameter name="locale" value="{page-envelope:language}"/>
+        </map:transform>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <!-- 
+        This matcher aggregates the Lenya page: breadcrumbs, tabs, menu etc. and the actual document content.
+        /lenyabody-raw-{1:rendertype}/{2:publication-id}/{3:area}/{4:doctype}/{5:default-language}/{6:language}/{7:path} 
+      -->
+      <map:match pattern="lenyabody-raw-*/*/*/*/*/*/**">
+        <map:aggregate element="cmsbody">
+          <map:part src="cocoon://modules/sitetree/breadcrumb/{2}/{3}/{5}/{6}/{7}.xml"/>
+          <map:part src="cocoon://modules/sitetree/tabs/{2}/{3}/{5}/{6}/{7}.xml"/>
+          <map:part src="cocoon://modules/sitetree/menu/{2}/{3}/{5}/{6}/{7}.xml"/>
+          <map:part src="cocoon://modules/sitetree/search/{2}/{3}/{5}/{6}/{7}.xml"/>
+          <map:part src="cocoon:/document-content/{1}/{2}/{3}/{7}"/>
+        </map:aggregate>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <!--
+        This match provides the XSLT to render a given doctype to XHTML
+        It checks for the existence of a doctype-specific one, and if none
+        exists, falls back to the default one.
+        /getDoctypeXSLT/{1:doctype}
+      -->
+      <map:match pattern="getDoctypeXSLT/*">
+        <map:select type="resource-exists">
+          <map:parameter name="prefix" value="fallback://"/>
+          <map:when test="fallback://lenya/modules/docustyle/xslt/page2xhtml-{1}.xsl">
+            <map:generate src="fallback://lenya/modules/docustyle/xslt/page2xhtml-{1}.xsl"/>
+          </map:when>
+          <map:otherwise>
+            <map:generate src="fallback://lenya/modules/docustyle/xslt/page2xhtml.xsl"/>
+          </map:otherwise>
+        </map:select>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+    </map:pipeline>
+    
+    <!-- This is the pipeline that ultimately builds the page. -->
+    <map:pipeline type="noncaching">
+      
+      <!-- 
+        This matcher takes the raw aggregated page content and applies SVG rendering and a doctype-specific
+        XSL transformation. It makes some meta information available to the XSLT, and demonstrates the use
+        of the LenyaMetaDataTransformer (see below).
+        /lenyabody-{1:rendertype}/{2:publication-id}/{3:area}/{4:doctype}/{5:path} 
+      -->
+      <map:match pattern="lenyabody-*/*/*/*/**">
+        <map:generate src="cocoon:/lenyabody-raw-{1}/{2}/{3}/{4}/{page-envelope:default-language}/{page-envelope:document-language}/{5}"/>
+        <map:transform src="fallback://lenya/modules/svg/xslt/image2svg.xsl"/>
+        <map:transform src="cocoon:/getDoctypeXSLT/{4}">
+          <map:parameter name="root" value="/{2}/{3}"/>
+          <map:parameter name="publication-id" value="{2}"/>
+          <map:parameter name="area" value="{3}"/>
+          <map:parameter name="url" value="{page-envelope:document-url}"/>
+          <map:parameter name="document-path" value="{page-envelope:document-path}"/>
+          <map:parameter name="document-type" value="{4}"/>
+          <map:parameter name="language" value="{page-envelope:document-language}"/>
+          <map:parameter name="contextprefix" value="{request:contextPath}"/>
+          <map:parameter name="lastPublishedUser" value="{access-control:user-name:{workflow:lastUser.publish}}"/>
+          <map:parameter name="lastPublishedDate" value="{workflow:lastDate.publish}"/>
+          <!-- Following is a show off to explain lenya.properties.xml -->
+          <map:parameter name="author" value="{properties:pubs.default.author}"/>
+          <map:parameter name="nodeName" value="{page-envelope:document-name}"/>
+        </map:transform>
+        <map:transform type="metaData">
+          <map:parameter name='pubid' value='{page-envelope:publication-id}'/>
+          <map:parameter name='area' value='{page-envelope:area}'/>
+        </map:transform>
+        <map:transform type="i18n">      
+          <map:parameter name="locale" value="{page-envelope:language}"/>
+        </map:transform>
+        <map:transform type="uuid2url"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+    </map:pipeline>
+    
+    <!-- This is the main entry point into the publication. This
+      pipeline uses the uriparametrizer to determine the doctype of this
+      request. It then aggregates the lenya menu (for the given area) and
+      the lenya body, the actual document. -->
+    <map:pipeline>
+      
+      <!-- 
+        Finally: this matcher handles requests for publication documents. 
+        /{1:area}/{2:document-path}.html
+      -->
+      <map:match pattern="*/**.html">
+        
+        <!-- If the requested language version of the document exists, we set a last-modified header. -->
+        <map:act type="language-exists">
+          <map:act type="set-header">
+            <map:parameter name="Last-Modified" value="{date-iso8601-rfc822:{page-envelope:document-lastmodified}}" />
+          </map:act>
+        </map:act>
+        
+        <!-- 
+          HEAD requests shouldn't have all the xslt overhead, all the user wants is the HTTP header information.
+          So the actual content generation is bypassed.
+        -->
+        <map:select type="request-method">
+          <map:when test="HEAD">
+            <map:generate src="context://lenya/content/util/empty.xml" />
+            <map:serialize type="xhtml"/>
+          </map:when>
+        </map:select>          
+        
+        <map:generate src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-path}"/>
+        
+        <map:select type="parameter">
+          <!-- you remember that {1} is the area, right? -->
+          <map:parameter name="parameter-selector-test" value="{1}"/>
+          <map:when test="live"/>
+          <map:otherwise>
+            <map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{1}/{2}.xml"/>
+          </map:otherwise>
+        </map:select>
+        <map:transform src="fallback://lenya/xslt/util/strip_namespaces.xsl"/>
+        <map:transform type="proxy"/>
+        
+        <map:act type="language-exists">
+          <map:serialize type="xhtml"/>
+        </map:act>
+        <map:serialize type="xhtml" status-code="404"/>
+        
+      </map:match>
+      
+    </map:pipeline>
+    
+    <!--
+      This pipeline handles all requests that do *not* end in ".html".
+    -->
+    <map:pipeline>
+      <map:match pattern="*/**">
+        <map:act type="language-exists">
+          <!--
+            A workaround for a byte-range issue with PDFs,
+            see http://marc.theaimsgroup.com/?l=xml-cocoon-dev&amp;m=112496255207733&amp;w=2 .
+            FIXME: still necessary?
+          -->
+          <map:match type="regexp" pattern="(.*\.)(pdf|PDF|Pdf)$"> 
+            <map:read src="lenya-document:{page-envelope:document-uuid},lang={page-envelope:document-language}{link:rev}" mime-type="application/pdf">
+              <map:parameter name="byte-ranges" value="false"/>
+            </map:read>
+          </map:match>      
+          <!-- Documents other than *.html are served as-is and do not require processing: -->
+          <map:read src="lenya-document:{page-envelope:document-uuid},lang={page-envelope:document-language}{link:rev}"/>
+        </map:act>
+        
+        <!-- 
+          If the action above fails (e.g. the document does not exist), call into the lenyabody pipeline.
+          It will generate a nice document-does-not-exist page for us.
+        -->
+        <map:generate src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-path}"/>
+        <map:select type="parameter">
+          <map:parameter name="parameter-selector-test" value="{1}"/>
+          <map:when test="live"/>
+          <map:otherwise>
+            <map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{1}/{2}?doctype={page-envelope:document-type}"/>
+          </map:otherwise>
+        </map:select>
+        <map:transform src="fallback://lenya/xslt/util/strip_namespaces.xsl"/>
+        <map:transform type="proxy"/>
+        <map:serialize type="xhtml" status-code="404"/>
+        
+      </map:match>
+      
+    </map:pipeline>
+    
+    
+  </map:pipelines>
+</map:sitemap>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org