You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2004/07/14 09:50:11 UTC
[Cocoon Wiki] Updated: JarProtocolExample
Date: 2004-07-14T00:50:10
Editor: GlorieuxFrédéric <fr...@xfolio.org>
Wiki: Cocoon Wiki
Page: JarProtocolExample
URL: http://wiki.apache.org/cocoon/JarProtocolExample
no comment
Change Log:
------------------------------------------------------------------------------
@@ -1,39 +1,43 @@
+Hi tried this a few months ago and found that the "jar:/" protocol don't check if the source have changed. I can't say if it's problem of cocoon cache or "jar:/" specification, but what I know is I can't use it to display i, real time an oo doc that people may edit. Some more ideas here [XfolioOpenOfficeGeneration]
+
+----
+
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>
-
-<!--
-if you don't want to "hard-code" localhost,
-don't forget the {servletPath} sitemap variable
-
-<map:read src="jar:http://{servletPath}/{1}.sxw!/meta.xml"/>
-
--->
-
- <!-- 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>
+{{{
+<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>
+
+<!--
+if you don't want to "hard-code" localhost,
+don't forget the {servletPath} sitemap variable
+
+<map:read src="jar:http://{servletPath}/{1}.sxw!/meta.xml"/>
+
+-->
+
+ <!-- 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: ===
@@ -47,10 +51,10 @@
Here is an example using a file relative to the context. In this case we get a file named {{{content.xml}}} inside an {{{open-office zip}}} file with a {{{.sxw}}} extension. The {{{realpath}}} module allows us to convert relative path to absolute ones.
-{{{
-<map:match src='**.sxw'>
- <map:generate src="jar:file:///{realpath:docu}/{0}!/content.xml"/>
- <map:transform src='open-office-to-docbook.xml'/>
- <map:serialize type='xml'/>
-</map:match>
+{{{
+<map:match src='**.sxw'>
+ <map:generate src="jar:file:///{realpath:docu}/{0}!/content.xml"/>
+ <map:transform src='open-office-to-docbook.xml'/>
+ <map:serialize type='xml'/>
+</map:match>
}}}