You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Klotz <pk...@iconet.wn.bawue.de> on 2003/03/07 09:34:30 UTC

Zip File Generator

Hi,

I'm wonderning how one could read a file that is compressed/archived e.g.
zip.
Let's say  I have a XML file that is compressed and so I would like to
uncompress it and then use this file in the normal file generator in a
pipeline. Is this possible and how?
I also looked whether I could use a reader to serve the zip file but then
I would only get the binary and not the uncompressed content of the file?
Or can I use the output from a ScriptGenerator?


Thanks for any help, Peter



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Zip File Generator

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
>
> Le Vendredi, 7 mars 2003, à 14:05 Europe/Zurich, Sylvain Wallez a écrit
> :
>
>> ...The JDK natively suppors the "jar:" protocol with URLs of the form
>> "jar:<url>!/<entry>"(see [1]) and as such is available in Cocoon.
>
> Wow, I didn't know that this was a standard JDK feature, thanks for
> pointing it out!
> Now I understand why I couldn't find the implementation of the jar:
> stuff in in Cocoon ;-)
lol :-D
>
> -Bertrand
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Zip File Generator

Posted by Bertrand Delacretaz <bd...@codeconsult.ch>.
Le Vendredi, 7 mars 2003, à 14:05 Europe/Zurich, Sylvain Wallez a écrit 
:

> ...The JDK natively suppors the "jar:" protocol with URLs of the form 
> "jar:<url>!/<entry>"(see [1]) and as such is available in Cocoon.

Wow, I didn't know that this was a standard JDK feature, thanks for 
pointing it out!
Now I understand why I couldn't find the implementation of the jar: 
stuff in in Cocoon ;-)

-Bertrand

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Zip File Generator

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Bertrand Delacretaz wrote:

>
> Le Vendredi, 7 mars 2003, à 09:41 Europe/Zurich, Upayavira a écrit :
>
>>> .... With the protocol, it shows you how to
>>
>> add a protocol to Cocoon of the form:
>>
>> zip://financenews.xml@http://www.newserver.com/news_2001.zip
>> or
>> zip://people/matthew.jpg@pictures.zip
>
>
> There is a jar: protocol (or Source?) in Cocoon already, search for 
> "jar:" in http://xml.apache.org/cocoon/userdocs/concepts/sitemap.html 
> for an example.
> As JARs and ZIPs share the same physical format, it should work for 
> ZIP files as well.


The JDK natively suppors the "jar:" protocol with URLs of the form 
"jar:<url>!/<entry>"(see [1]) and as such is available in Cocoon.

However the <url> part has to be an URL understood by the JDK (e.g. 
"file:", "http:", etc), and therefore you cannot use the fancy Cocoon 
protocols such as "cocoon:" or "context:".

Hope this helps,
Sylvain

[1] http://java.sun.com/j2se/1.3/docs/api/java/net/JarURLConnection.html

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Zip File Generator

Posted by Bertrand Delacretaz <bd...@codeconsult.ch>.
Le Vendredi, 7 mars 2003, à 09:41 Europe/Zurich, Upayavira a écrit :
>> .... With the protocol, it shows you how to
> add a protocol to Cocoon of the form:
>
> zip://financenews.xml@http://www.newserver.com/news_2001.zip
> or
> zip://people/matthew.jpg@pictures.zip

There is a jar: protocol (or Source?) in Cocoon already, search for 
"jar:" in http://xml.apache.org/cocoon/userdocs/concepts/sitemap.html 
for an example.
As JARs and ZIPs share the same physical format, it should work for ZIP 
files as well.

-Bertrand

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: Zip File Generator

Posted by Upayavira <uv...@upaya.co.uk>.
> I'm wonderning how one could read a file that is compressed/archived
> e.g. zip. Let's say  I have a XML file that is compressed and so I
> would like to uncompress it and then use this file in the normal file
> generator in a pipeline. Is this possible and how? I also looked
> whether I could use a reader to serve the zip file but then I would
> only get the binary and not the uncompressed content of the file? Or
> can I use the output from a ScriptGenerator?

Peter, there is an example of how to do exactly what you want in the "Cocoon: 
Building XML Applications" book. It uses zip as an example of how to write 
readers, generators and sources/protocols. With the protocol, it shows you how to 
add a protocol to Cocoon of the form:

zip://financenews.xml@http://www.newserver.com/news_2001.zip
or
zip://people/matthew.jpg@pictures.zip

If you haven't seen the book, I'd highly recommend it.

Regards, Upayavira


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org