|
|
@@ -100,7 +100,7 @@ public class DownloadController {
|
|
|
*/
|
|
|
@GetMapping(value="/download/{fileName}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
|
|
@ResponseBody
|
|
|
- public byte[] download(@PathVariable("fileName") BigInteger idInstanciaTasca, HttpServletResponse response) throws FileNotFoundException {
|
|
|
+ public ResponseEntity<byte[]> download(@PathVariable("fileName") BigInteger idInstanciaTasca, HttpServletResponse response) throws FileNotFoundException {
|
|
|
|
|
|
try {
|
|
|
InstanciaTascaDTO i = findByIdTasca(idInstanciaTasca);
|
|
|
@@ -113,16 +113,14 @@ public class DownloadController {
|
|
|
}
|
|
|
else{
|
|
|
file = new FileSystemResource(this.filePath+i.getEvidencia());
|
|
|
- System.out.println(i.getEvidencia()+".zip");
|
|
|
response.setHeader("Content-Disposition", "attachment; filename="+i.getEvidencia());
|
|
|
}
|
|
|
|
|
|
if (!file.exists()) {
|
|
|
- return new FileSystemResource(this.fileNotFound).getInputStream().readAllBytes();
|
|
|
+ return ResponseEntity.ok(new FileSystemResource(this.fileNotFound).getInputStream().readAllBytes());
|
|
|
}
|
|
|
|
|
|
- response.setContentType("application/zip");
|
|
|
- return file.getInputStream().readAllBytes();
|
|
|
+ return ResponseEntity.ok(file.getInputStream().readAllBytes());
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|