aspose file tools*
The moose likes Servlets and the fly likes Empty Downloaded zip file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Empty Downloaded zip file" Watch "Empty Downloaded zip file" New topic
Author

Empty Downloaded zip file

Amy Hafer
Greenhorn

Joined: Mar 29, 2001
Posts: 6
Hi!
I am new to this site but it is by far the most user friendly I have been to. Hoping you can help..
I am writing a servlet that sends a zip file to the user of some files that he/she requested. I am able to create the zip file and write the correct entries to it on the server but all that is available for download is an empty zip file. I think I have major problems understanding output streams.
I was using the
ServletOutputStream out=response.getOutputStream();
I have also tried
PrintWriter out = new PrintWriter(response.getOutputStream());
then I thought all you need is to start the response:
response.setContentType("application/zip");
response.setHeader("Content-Disposition","attachment;filename=" + thefile.getName());
but I don't know how to take the ZipOutputStream or is it the FileOutputStream and send it via out.println()
Any help would be most appreciated!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Empty Downloaded zip file