| Author |
Download zip or .gz file from server
|
R K Parulekar
Ranch Hand
Joined: May 29, 2005
Posts: 66
|
|
Hi How to download zip or .gz file from server using servlet or jsp.. Thanks Ravi
|
"A wish changes nothing. A decision changes everything." - Unknown
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26201
|
|
Ravi, You mean download through the user's browser, right? Have your servlet set the MIME type for compressed/zip files and then output the binary data just like you would have output the HTML.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
R K Parulekar
Ranch Hand
Joined: May 29, 2005
Posts: 66
|
|
Thanks Jeanne Yes you r right, it's download thru user's browser.. When user clicks download data link (browser) .. My programme generates a csv file and same is downloaded to the client... Now ,what i want,instaed of downloading csv file I want to zip and download it.. My code looks like ... res.setHeader("Content-Encoding", "gzip"); res.setHeader("Content-Disposition", "attachment;filename=\"" + fileName "\""); javax.servlet.ServletOutputStream servletoutputstream = res.getOutputStream(); GZIPOutputStream gzipoutputstream = new GZIPOutputStream ( servletoutputstream); ... Any suggestions !! Ravi..
|
 |
 |
|
|
subject: Download zip or .gz file from server
|
|
|