The following code downloads a zip file. Am I doing something wrong here? The zip file downloads but can't unarchive.
ByteArrayOutputStream baos = getByteArrOutputStream();
ZipOutputStream zos = new ZipOutputStream(baos);
zos.putNextEntry(new ZipEntry("report.txt"));
zos.write(baos.toByteArray());
zos.closeEntry();
zos.close();
this.setBuffer(baos.toByteArray());
this.setContentType("application/zip");
Try
this.setContentType("application/octet-stream")
instead of
this.setContentType("application/zip")
it should work.