You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2003/03/12 02:00:03 UTC
[WIKI-UPDATE] HowTos JarProtocolExample Wed Mar 12 02:00:03 2003
Page: http://wiki.cocoondev.org/Wiki.jsp?page=HowTos , version: 75 on Wed Mar 12 00:06:31 2003 by Con
+
+ * __[JarProtocolExample]__ -- how to use the jar:/ protocol to read data from a jar (or zip) file
Page: http://wiki.cocoondev.org/Wiki.jsp?page=JarProtocolExample , version: 1 on Wed Mar 12 00:14:14 2003 by Con
New page created:
+ Here is a sitemap snippet that shows how the jar:/ protocol can be used to read data from
+ jar files or zip files. -- [Con]
+
+ {{{
+ <map:pipelines>
+ <!-- read content from out of a zip file -->
+ <map:pipeline>
+ <map:match pattern="*/**.xml">
+ <map:generate src="jar:http://localhost/jar-test/{1}!/{2}.xml"/>
+ <map:serialize type="xml"/>
+ </map:match>
+ </map:pipeline>
+ <map:pipeline>
+ <map:match pattern="*/**.jpg">
+ <map:read src="jar:http://localhost/jar-test/{1}!/{2}.jpg"/>
+ </map:match>
+ </map:pipeline>
+
+ <!-- read the archive file -->
+ <map:pipeline>
+ <map:match pattern="*.zip">
+ <map:read src="{1}.zip"/>
+ </map:match>
+ <map:match pattern="*.jar">
+ <map:read src="{1}.jar"/>
+ </map:match>
+ </map:pipeline>
+ </map:pipelines>
+ }}}
+
+ !Note:
+ This sitemap is intended to be mounted as /jar-test - it uses http to access the zip file. This is because the jar: protocol is not aware of the cocoon: protocol. An alternative would be to access
+ the jar file with the file: protocol, which would involve specifying a complete file path name.
+
+ To test it, access it as:
+ http://localhost/jar-test/test.zip/test.jpg
+