I wanted to add a REST service to download a resource found by URL, and archived in ZIP format.
I use the following code to do that:
@GetMapping(value = "/downloadAsZip", produces = "application/zip")
@ResponseBody
public Resource downloadSeqRunBinary(HttpServletResponse response) throws IOException {
Resource aResource = new UrlResource("/some/path");
response.setHeader("Content-Disposition", "attachment; filename="aResource.zip");
return aResource;
}
As a result, I got my zip file, but looks like its broken or doesn't have a proper format, since its unpacked to a .zip.cpgz file.
Could someone point me out what is wrong in my code?