Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @GetMapping("/download/{filename:.+}")
- @ResponseBody
- public ResponseEntity<Resource> downloadFile(@PathVariable String filename) {
- Resource resource = storageService.loadAsResource(filename);
- return ResponseEntity.ok()
- .header(HttpHeaders.CONTENT_DISPOSITION,
- "attachment; filename=\"" + resource.getFilename() + "\"")
- .body(resource);
- }
Add Comment
Please, Sign In to add comment