You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ne...@apache.org on 2007/11/02 22:08:52 UTC

svn commit: r591462 - /lenya/trunk/src/pubs/default/sitemap.xmap

Author: nettings
Date: Fri Nov  2 14:08:51 2007
New Revision: 591462

URL: http://svn.apache.org/viewvc?rev=591462&view=rev
Log:
remove file caching mechanism from default publication.
cache reading used to be disabled by default, but we still did cache
writing at the expense of three unnecessary transforms per request.
it was not feasible to just comment it out, since part of the goal was
to make the sitemap easier to grasp, and cache writing involved plenty
nested conditionals.

there never was proper cache invalidation anyways. so people can now just
wget -l -r their site to some static webserver after edits...

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=591462&r1=591461&r2=591462&view=diff
==============================================================================
--- lenya/trunk/src/pubs/default/sitemap.xmap (original)
+++ lenya/trunk/src/pubs/default/sitemap.xmap Fri Nov  2 14:08:51 2007
@@ -39,14 +39,6 @@
 
   <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>
-
     <!-- This pipeline handles helper requests and metadata, not the actual publication documents -->
     <map:pipeline>
 
@@ -303,122 +295,89 @@
             <map:serialize type="xhtml"/>
           </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">
-          <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: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>
-          <!-- 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>
-
-            <!-- 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">
-                <!-- do nothing for live -->
-              </map:when>
-              <map:otherwise>
-                <!-- for all other areas, we want a GUI menu (handled by global-sitemap.xmap -->
-                <map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{1}/{2}.xml"/>
-                <!-- 
-                    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:otherwise>
-            </map:select>
+            <!-- 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>
 
+        <!-- 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">
+            <!-- do nothing for live -->
+          </map:when>
+          <map:otherwise>
+            <!-- for all other areas, we want a GUI menu (handled by global-sitemap.xmap -->
+            <map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{1}/{2}.xml"/>
             <!-- 
-                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)
+                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/util/strip_namespaces.xsl"/>
-
-            <!-- 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>
-              <!-- 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"/>
+            <!--
+            <map:transform src="fallback://lenya/xslt/authoring/addJavaScript.xsl">
+              <map:parameter name="scriptSRC" value="/modules/linkcheck/linkreporter.js"/>
+            </map:transform>
+            -->
+          </map:otherwise>
+        </map:select>
 
-            <!-- the proxy transformer handles proxy-related URL rewriting -->
-            <map:transform type="proxy"/>
+        <!-- 
+            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"/>
 
-            <map:act type="language-exists">
-              <map:serialize type="xhtml"/>
+        <!-- client cache expiration settings -->
+        <map:select type="parameter">
+          <map:parameter name="parameter-selector-test" value="{1}"/>
+          <!-- for live area: -->
+          <map:when test="live">
+            <!-- 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>
-            <!-- 
-               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"/>
-          </map:otherwise>
+          </map:when>
+          <!-- 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"/>
+
       </map:match>
-      
+
     </map:pipeline>
-      
+
     <!--
        This pipeline handles all requests that do *not* end in ".html".
     -->



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