• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to send a Zip file to CLient

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i am getting the compressed (zipped) folder is invalid or corrupted on UI screen upon selecting the open button on dialog box. please help me out.......

HttpServletResponse response = HttpJSFUtil.getResponse();
File f = new File("C:\\Krishna\\AL3Files.zip");

OutputStream outputStream;
try {
outputStream = response.getOutputStream();

response.setContentType("application/zip");
response.setHeader("Content-Disposition","inline; filename=AL3Files.zip;");

byte[] arBytes = new byte[(int) f.length()];
FileInputStream is= new FileInputStream(f);
is.read(arBytes);
outputStream.write(arBytes);
outputStream.flush();

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 
Sheriff
Posts: 7392
1412
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Krishna, welcome to JavaRanch
Please UseRealWords instead of Invali, thi, pblm,.... and please UseCodeTags when you post a code.
Can you please click the button and make them changed?
 
It was the best of times. It was the worst of times. It was a tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic