String path = request.getSession().getServletContext()
.getRealPath("/file");
String filename = "apache-cxf-2.7.10.zip";
String filepath = path + "/" + filename;
InputStream inputstream = new FileInputStream(filepath);
response.reset();
response.setHeader("Content-Disposition", "attachment; filename="
+ filename);
response.setContentType("application/zip");
ServletOutputStream out = response.getOutputStream();
byte[] content = new byte[1024];
int length = 0;
while ((length = inputstream.read(content)) != -1) {
out.write(content, 0, length);
}
out.write(content);
out.flush();
out.close();