Downloading GZip files using jsp.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   chandrasekar_ramaswamy
Posted On:   Thursday, June 6, 2002 11:17 PM

Iam using java.io.GZIPOutputStream to defalte and download a file from the server.Iam using jsp.The code iam using is: FileInputStream inputStream=new FileInputStream("filename"); GZIPOutputStream zipOutStream = new GZIPOutputStream( response.getOutputStream()); out.clearBuffer(); int c; while ((c=fis.read()) != -1){ zipOutStream.write(c); } out.flush(); out.clear(); The problem is that the files gets downloaded, but it doesn't seem to be a valid archive and it is corrupted. Iam setting the content type as "application/download". Do i have to set any headers for this.    More>>

Iam using java.io.GZIPOutputStream to defalte and download a file from the server.Iam using jsp.The code iam using is:

FileInputStream inputStream=new FileInputStream("filename");

GZIPOutputStream zipOutStream = new GZIPOutputStream(
response.getOutputStream());

out.clearBuffer();
int c;
while ((c=fis.read()) != -1){
zipOutStream.write(c);
}

out.flush();
out.clear();

The problem is that the files gets downloaded, but it doesn't seem to be a valid archive and it is corrupted.
Iam setting the content type as "application/download".

Do i have to set any headers for this.

   <<Less
About | Sitemap | Contact