Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Empty Downloaded zip file  RSS feed

Amy Hafer
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.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!!!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!