I'm having a problem, I create a ZIP file with PDF files in it in JAVA
@Override
@ResponseBody
@RequestMapping(value = "pdfDownload", method = RequestMethod.POST, produces = "application/zip")
public byte[] generatePDFs(
@RequestParam(value = "date", required = true) String date,
Principal principal,
HttpServletResponse response) {
String filename;
PrintRequest pr = new PrintRequest ();
List<String> pis = new ArrayList<> ();
pis.add ("3453453535");
pr.setDate ("032015");
pr.setPids (pis);
filename = pr.getDate () + ".zip";
response.setContentType ("application/zip");
response.setHeader("Content-Disposition", "attachment; filename="+ filename);
return createZip (pr, principal);
}
Creating the ZIP file works fine, but if I call this with jQuery AJAX POST I get back the bitstream as result but cannot download the file.
Btw. the file is created on the fly and do not lie on the server.
Hope someone can help me.
Best regards!