Author: nettings
Date: Wed Oct 31 08:15:00 2007
New Revision: 590708
URL: http://svn.apache.org/viewvc?rev=590708&view=rev
Log:
added loads of comments (mostly FIXMEs, please review), removed dead XUL
code.
Modified:
lenya/trunk/src/pubs/default/sitemap.xmap
Modified: lenya/trunk/src/pubs/default/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/pubs/default/sitemap.xmap?rev=590708&r1=590707&r2=590708&view=diff
==============================================================================
--- lenya/trunk/src/pubs/default/sitemap.xmap (original)
+++ lenya/trunk/src/pubs/default/sitemap.xmap Wed Oct 31 08:15:00 2007
@@ -18,6 +18,14 @@
<!-- $Id$ -->
+
+<!-- ============ cruft removal project: ================
+
+ lenyabody-** and navigation-element-** are only used internally in this sitemap and can be refactored without side effects.
+
+-->
+
+
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
@@ -30,9 +38,15 @@
</map:components>
<map:views>
+<!-- ============ cruft removal project: ================
+
+this view's from-label does not exist.
+
<map:view from-label="aggregation" name="aggregation">
<map:serialize type="xml"/>
</map:view>
+
+-->
<map:view from-position="last" name="links">
<map:serialize type="links" />
</map:view>
@@ -53,27 +67,35 @@
<map:pipelines>
+ <!-- FIXME: the location of Lenya's cache should either be a global convention
+ or a per-publication configuration option in publication.xml. -->
<map:component-configurations>
<global-variables>
<cache-dir>work/cache</cache-dir>
</global-variables>
</map:component-configurations>
- <!-- Blog module mounted -->
-<!--
- <map:pipeline>
- <map:match pattern="*/news/**">
- <map:mount src="../../modules/blog/sitemap.xmap" uri-prefix="news" check-reload="yes"/>
- </map:match>
- </map:pipeline>
--->
- <!-- Introspection -->
+
+
+ <!-- This pipeline handles helper requests and metadata, not the actual publication documents -->
<map:pipeline>
+
+ <!-- Neutron introspection
+ The location of the introspection file is defined in <link rel="neutron-introspection"/>
+ (see xslt/page2xhtml.xsl).
+ -->
<map:match pattern="*/**/introspection.xml">
<map:select type="resource-exists">
<map:when test="fallback://lenya/modules/neutron/sitemap.xmap">
- <map:mount uri-prefix="" src="{fallback:lenya/modules/neutron/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
+ <!-- NB: there are problems with the fallback:// source factory when mounting sitemaps,
+ that's why the corresponding input module {fallback:} is used. -->
+ <map:mount
+ uri-prefix=""
+ src="{fallback:lenya/modules/neutron/sitemap.xmap}"
+ check-reload="true"
+ reload-method="synchron"
+ />
</map:when>
<map:otherwise>
<map:generate src="context:/lenya/content/util/empty.xml"/>
@@ -81,39 +103,58 @@
</map:otherwise>
</map:select>
</map:match>
- </map:pipeline>
-
- <map:pipeline>
-
- <map:match pattern="**">
+
+<!--
+ FIXME: the whole webdav shebang should be handled by the webdav module sitemap.
+-->
+ <!-- catch webdav GET requests. -->
<map:match pattern="*/webdav**">
<map:mount uri-prefix="{1}/" src="{fallback:lenya/modules/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
</map:match>
+
+ <!-- catch PUT requests (used by webdav clients) -->
<map:select type="request-method">
<!-- many client editors like to PUT changes -->
<map:when test="PUT">
<map:mount uri-prefix="" src="{fallback:lenya/modules/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
</map:when>
</map:select>
- </map:match>
+ <!-- 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://xslt/page2xhtml.xsl"/>
<map:serialize type="xml"/>
</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">
-
+
+ <!-- RSS formatting.
+ FIXME: this should be handled by an RSS feed module!
+ -->
<map:match pattern="**.rss">
<map:generate src="{resource-type:format-rss}"/>
<map:serialize type="xml"/>
</map:match>
+ <!-- FIXME: either this should be moved into a metadata module, or at least we need to establish
+ some standard for magic extra suffixes and stick to it.
+ Here we use .html.meta, bxe uses .bxe.html.
+ -->
<map:match pattern="*/**.html.meta">
<map:generate type="lenyaMetaData" src="lenya-document:{page-envelope:document-uuid},area={1}"/>
<map:serialize type="xml"/>
@@ -123,18 +164,13 @@
<map:serialize type="xml"/>
</map:match>
- <!-- navigation-element/{1:widget}/{2:pub-id}/{3:area}/{4:default-language}/{5:language}/{6:path} -->
- <map:match pattern="navigation-element/*/*/*/*/*/**">
- <map:generate src="cocoon://modules/sitetree/{1}/{2}/{3}/{4}/{5}/{6}.xml"/>
- <map:serialize type="xml"/>
- </map:match>
-
<!-- {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}"/>
@@ -149,13 +185,16 @@
<map:serialize type="xml"/>
</map:match>
- <!-- /lenyabody-{1:rendertype}/{2:publication-id}/{3:area}/{4:doctype}/{5:default-language}/{6:language}/{7:path} -->
+ <!--
+ 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:/navigation-element/breadcrumb/{2}/{3}/{5}/{6}/{7}"/>
- <map:part src="cocoon:/navigation-element/tabs/{2}/{3}/{5}/{6}/{7}"/>
- <map:part src="cocoon:/navigation-element/menu/{2}/{3}/{5}/{6}/{7}"/>
- <map:part src="cocoon:/navigation-element/search/{2}/{3}/{5}/{6}/{7}"/>
+ <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://modules/languageselector/text-none/flagsize-13"/>
<map:part src="cocoon:/document-content/{1}/{2}/{3}/{7}"/>
</map:aggregate>
@@ -166,6 +205,7 @@
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">
@@ -182,11 +222,15 @@
</map:pipeline>
- <!-- This is the pipeline that builds the page. It aggregates all
- the navigational elements (breadcrumb, tabs, menu) with the actual
- content of the document. -->
+ <!-- This is the pipeline that ultimately builds the page. -->
<map:pipeline type="noncaching">
- <!-- /lenyabody-{1:rendertype}/{2:publication-id}/{3:area}/{4:doctype}/{5:path} -->
+
+ <!--
+ 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"/>
@@ -206,12 +250,13 @@
<map:parameter name="nodeName" value="{page-envelope:document-name}"/>
</map:transform>
+ <!-- FIXME: why is the title handling inside a language-exists action? please document! -->
<map:act type="language-exists">
<map:transform src="fallback://xslt/addXhtmlTitle.xsl">
<map:parameter name="title" value="{dublincore:title}"/>
</map:transform>
</map:act>
-
+
<!-- This is a demonstration of the generic meta data transformer
described in bug 39891.
@@ -225,7 +270,7 @@
<value xmlns="http://apache.org/lenya/meta/1.0/" value="2006-09-11 12:44:05" element="date" />
Otherwise it will return the value as characters.
- -->
+ -->
<map:transform type="metaData">
<map:parameter name='pubid' value='{page-envelope:publication-id}'/>
<map:parameter name='area' value='{page-envelope:area}'/>
@@ -236,6 +281,7 @@
<map:transform type="uuid2url"/>
<map:serialize type="xml"/>
</map:match>
+
</map:pipeline>
<!-- This is the main entry point into the publication. This
@@ -244,14 +290,26 @@
the lenya body, the actual document. -->
<map:pipeline>
+ <!--
+ FIXME: this is a BXE-specific hack that should be handled by BXE's module sitemap. The publication
+ should not be concerned with BXE-specific pre-processing of documents.
+ -->
<map:match pattern="**.bxe.html">
<map:generate src="cocoon:/lenyabody-edit/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-path}"/>
<map:transform type="proxy"/>
<map:serialize type="xml"/>
</map:match>
+ <!--
+ Finally: this matcher handles requests for publication documents.
+ /{1:area}/{2:document-path}.html
+ -->
<map:match pattern="*/**.html">
+ <!--
+ The default publication does not have content by default. This check provides the user with a dialog
+ to import example content. It's not needed for production systems.
+ -->
<map:select type="resource-exists">
<map:when test="lenya://lenya/pubs/{page-envelope:publication-id}/content/authoring/sitetree.xml"/>
<map:otherwise>
@@ -259,13 +317,17 @@
</map:otherwise>
</map:select>
+ <!-- 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 request shouldn't have all the xslt overhead -->
+ <!--
+ 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" />
@@ -273,90 +335,113 @@
</map:when>
</map:select>
+ <!--
+ Lenya provides its own caching mechanism. There is a source writing transformer that will store rendered pages
+ in {global:cache-dir}. Hence we should first check for every request if a cached version already exists, before
+ starting the actual rendering process.
+ NOTE: the cache is disabled by default. That means it has seen very little testing. And it does not do proper cache
+ invalidation, so it's probably only useful as a quick performance hack on a mostly static site.
+ -->
+ <!-- do we have this request in the cache? -->
<map:select type="resource-exists">
- <!-- Read from cache -->
- <!-- If configured within Apache then mod_lenya will nevertheless read from cache -->
<map:when test="context:/lenya/pubs/{page-envelope:publication-id}/{global:cache-dir}/{1}/{2}.htmlDISABLED">
+ <!-- YES. Just read it from the cache and be done: -->
<map:read src="context:/lenya/pubs/{page-envelope:publication-id}/{global:cache-dir}/{1}/{2}.html" mime-type="text/html"/>
</map:when>
- <!-- Write to cache and serialize -->
+ <!-- No. Generate the page and write it to the cache. -->
<map:otherwise>
-
+ <!--
+ FIXME: the "rendertype" parameter is a hack for BXE and should be handled by the bxe module.
+ Moreover, it doesn't make much sense to cache documents in the authoring area that are about to be edited anyway.
+ -->
<map:select type="parameter">
<map:parameter name="parameter-selector-test" value="{request-param:rendertype}"/>
<map:when test="edit">
+ <!-- put the bxe_xpath attribute into the page -->
<map:generate src="cocoon:/lenyabody-edit/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-path}"/>
</map:when>
<map:otherwise>
+ <!-- sane page w/o hacks -->
<map:generate src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-path}"/>
</map:otherwise>
</map:select>
- <!-- TODO: Either fix XUL or remove it, only works under Authoring at moment -->
- <!-- and the text of menu items is not shown -->
- <!-- Uncomment to enable XUL menus under Mozilla 5 -->
- <!-- <map:select type="browser">
- <map:when test="mozilla5">
- <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}.xml?doctype={page-envelope:document-type}&uiml=xul"/>
- </map:otherwise>
- </map:select>
- <map:serialize type="xml" mime-type="application/vnd.mozilla.xul+xml"/>
- </map:when>
- <map:otherwise>
- -->
+
+ <!-- Menu generation -->
<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:when test="live">
+ <!-- do nothing for live -->
+ </map:when>
<map:otherwise>
+ <!-- for all other areas, we want a GUI menu (handled by global-sitemap.xmap -->
+ <!-- FIXME: the ?doctype parameter doesn't seem to be used (see global-sitemap.xmap). -->
<map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{1}/{2}.xml?doctype={page-envelope:document-type}"/>
- <!-- TODO: External Links checking should be optional on a document by document basis -->
- <!-- uncomment to turn on external broken link reporting -->
- <!--<map:transform src="fallback://lenya/xslt/authoring/addJavaScript.xsl">
+ <!--
+ external broken link reporting (pretty much untested)
+ TODO: External Links checking should be optional on a document by document basis.
+ -->
+ <!--
+ <map:transform src="fallback://lenya/xslt/authoring/addJavaScript.xsl">
<map:parameter name="scriptSRC" value="/modules/linkcheck/linkreporter.js"/>
- </map:transform>-->
+ </map:transform>
+ -->
</map:otherwise>
</map:select>
+
+ <!--
+ strip xhtml namespace prefix to ensure compatibility with non-XML conformant browsers
+ workaround to avoid empty script, style and textarea tags (firefox chokes on those)
+ -->
<map:transform src="fallback://lenya/xslt/util/strip_namespaces.xsl"/>
- <!-- Write to cache for requests from live area -->
+
+
+ <!-- Cache writing -->
<map:select type="parameter">
<map:parameter name="parameter-selector-test" value="{1}"/>
+ <!-- for live area: -->
<map:when test="live">
+ <!-- prepare content for source writing transformer -->
<map:transform src="fallback://lenya/xslt/authoring/edit/addSourceTags.xsl">
<map:parameter name="source" value="context:/lenya/pubs/{page-envelope:publication-id}/{global:cache-dir}/{1}/{2}.html"/>
</map:transform>
<map:transform type="write-source">
<map:parameter name="serializer" value="xhtml"/>
</map:transform>
+ <!-- remove the source writing transformer cruft again before serving the page -->
<map:transform src="fallback://lenya/xslt/authoring/edit/removeSourceTags.xsl"/>
+ <!-- set cache expiration header according to resource type configuration (<expires/>) -->
<map:act type="set-header">
<map:parameter name="Expires" value="{date-iso8601-rfc822:{doc-info:{page-envelope:publication-id}:{page-envelope:area}:{page-envelope:document-uuid}:{page-envelope:document-language}:expires}}"/>
</map:act>
</map:when>
- <!-- Turn off caching in authoring area -->
+ <!-- for other areas -->
<map:otherwise>
+ <!-- tell the browser not to cache stuff so that the user always sees up-to-date content -->
<map:act type="set-header">
<map:parameter name="Cache-Control" value="no-cache" />
<map:parameter name="Pragma" value="no-cache"/>
</map:act>
</map:otherwise>
</map:select>
+
<!-- pretty-print output for easier debugging and for the benefit of new users
NOTE: you may want to disable this in production for performance reasons,
but it's on by default in the default publication to make the generated code
easier to work with for new users. -->
<map:transform src="fallback://lenya/modules/prettyprinting/xslt/xml2nicexml.xsl"/>
+
<!-- the proxy transformer handles proxy-related URL rewriting -->
<map:transform type="proxy"/>
+
<map:act type="language-exists">
<map:serialize type="xhtml"/>
</map:act>
+ <!--
+ When the requested document does not exist, we generate a nice error page.
+ Still, it's not what the user wants, so make sure we send a 404 "not found".
+ -->
<map:serialize type="xhtml" status-code="404"/>
- <!-- Uncomment to enable XUL menus under Mozilla 5 -->
- <!-- </map:otherwise>
- </map:select> -->
</map:otherwise>
</map:select>
@@ -364,18 +449,30 @@
</map:pipeline>
+ <!--
+ This pipeline handles all requests that do *not* end in ".html".
+ -->
<map:pipeline>
<map:match pattern="*/**">
- <!-- TODO: http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=112496255207733&w=2 -->
<map:act type="language-exists">
+ <!--
+ A workaround for a byte-range issue with PDFs,
+ see http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=112496255207733&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}"/>
@@ -387,6 +484,7 @@
<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>
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.