Creating a .zip file from within JSP

I am developing a web-based data retrieval utility whereby researchers can download multiple data files pertaining to work they have had done in our labs. These files are zipped on the fly and then delivered to the end user via JSP. My zip files are created using a utility class, and the desired directory to be zipped and the desired resulting filename are passed to a public static method.

If I call this method from within a test application at the command line, the .zip file is created perfectly. However, when the same method is called from within a JSP Scriptlet, the .zip file is corrupted. Comparing the size of the two files, the one created by the JSP page is always smaller.

If anyone can shed any light on this situation it would be greatly appreciated!

[793 byte] By [mestine] at [2007-9-26 3:52:51]
# 1
This may sound silly. But are you sure you are invoking the absolute same method from JSP as the one from the test application that works ?Could there be some other class or version of class lying around and gets resolved only when running from inside JSP ?
neville_sequeira at 2007-6-29 12:40:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Actually that's not a bad thought. However, I rewrote the code from scratch today using DIFFERENT method names and signatures from the old version. There is only one version now that could possibly be resolved.Thanks for the thought!
mestine at 2007-6-29 12:40:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

correct if I understood u right

whats process u are using to download the file after its ziped

I think you are not setting the data transfer mode to binary when u do that ,,,,,,,

If u are using FTP ,,, u got to set the file type as binary

this works fine when u do it standalone(from command line ) because it is not using any FTP or HTTP

Hope this will help you

Thanks

Sampath ...

Sampathrt at 2007-6-29 12:40:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I am using a regular http download with mime-type application/octet-stream. However, when I ftp the file down manually (with binary) following its creation, the file is corrupted. Therefore the file has to be corrupted by the zipping process and not the d/l process.

Again, thanks for the comment!

mestine at 2007-6-29 12:40:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...