cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@cocoon.apache.org
Subject [Cocoon Wiki] Updated: ResourceExistsAction
Date Sat, 23 Oct 2004 00:23:31 GMT
   Date: 2004-10-22T17:23:31
   Editor: RossGardler <rgardler@apache.org>
   Wiki: Cocoon Wiki
   Page: ResourceExistsAction
   URL: http://wiki.apache.org/cocoon/ResourceExistsAction

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -1,57 +1,59 @@
 === This action is being slowly phased out in favor of the ResourceExistsSelector ===
 
+(See ResourceExistsSelector)
+
 This action allows you to process different pipelines based on whether a resource exists.
 This is useful when you have this sort of a pipeline:
 
-{{{
-<map:match pattern="foo/*/">
-  <map:generate src="docs/{1}.xml"/>
-  <map:transform src="xslt/foo2html.xsl"/>
-  <map:serialize type="xhtml"/>
-</map:match>
+{{{
+<map:match pattern="foo/*/">
+  <map:generate src="docs/{1}.xml"/>
+  <map:transform src="xslt/foo2html.xsl"/>
+  <map:serialize type="xhtml"/>
+</map:match>
 }}}
 
 Althought the wildcards in the sitemap are extremely powerful, you will run into problems
when someone requests a URL which will substitute to a file that does not exist:
 
-{{{
-GET /foo/nowhere/ HTTP/1.1
+{{{
+GET /foo/nowhere/ HTTP/1.1
 }}}
 
 Obviously, the sitemap will look for {{{docs/nowhere.xml}}}, it won't be found, and you'll
end up with an ugly {{{ResourceNotFoundException}}}.  
 
 If you only care about reporting that a resource does not exist, you have this option:
 
-{{{
-<map:pipeline>
-<map:handle-errors type="404">
-    <map:transform src="xslt/error2html.xsl"/>
-    <map:serialize type="html"/>
-</map:handle-errors>
-</map:pipeline>
+{{{
+<map:pipeline>
+<map:handle-errors type="404">
+    <map:transform src="xslt/error2html.xsl"/>
+    <map:serialize type="html"/>
+</map:handle-errors>
+</map:pipeline>
 }}}
 
 However, if you wish to "fall-back" to a different pipeline if a file doesn't exist, you
may use the !ResourceExistsAction:
 
 (inspired from the [http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=102188726924367&w=2
mailing list])
 
-{{{
-<map:match pattern="foo/*/">
-
-  <!-- check to see if the requested resource is actually a valid source document -->
-
-  <map:act type="resource-exists">
-    <map:parameter name="url" value="context://documents/{1}.xml"/>
-    <map:generate src="context://documents/{../1}.xml" type="file"/>
-    <map:transform src="xslt/doc2html.xsl"/>
-    <map:serialize type="xhtml"/>
-  </map:act>
-
-  <!-- otherwise, we can do this stuff -->
-
-  <map:generate src="docs/system/notfound.xml"/>
-  <map:transform src="xslt/notfound2html.xsl/>
-  <map:serialize type="xhtml"/>
-
-</map:match>
+{{{
+<map:match pattern="foo/*/">
+
+  <!-- check to see if the requested resource is actually a valid source document -->
+
+  <map:act type="resource-exists">
+    <map:parameter name="url" value="context://documents/{1}.xml"/>
+    <map:generate src="context://documents/{../1}.xml" type="file"/>
+    <map:transform src="xslt/doc2html.xsl"/>
+    <map:serialize type="xhtml"/>
+  </map:act>
+
+  <!-- otherwise, we can do this stuff -->
+
+  <map:generate src="docs/system/notfound.xml"/>
+  <map:transform src="xslt/notfound2html.xsl/>
+  <map:serialize type="xhtml"/>
+
+</map:match>
 }}}
 
 '''note''':

Mime
View raw message