Created
March 21, 2017 08:42
-
-
Save FreeFly19/7581963665561d16f5b2baf6728c87cb to your computer and use it in GitHub Desktop.
Getting file from Controller Spring WEB MVC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @GetMapping(value = "/{documentId}/content") | |
| public ResponseEntity<FileSystemResource> downloadContent(@PathVariable("documentId") Long documentId) { | |
| FileSystemResource fileSystemResource = documentService.getContent(documentId); | |
| return ResponseEntity | |
| .ok() | |
| .contentType(MediaType.valueOf(documentService.getContentType(documentId))) | |
| .body(fileSystemResource); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment