Guest User

Untitled

a guest
Feb 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. @GetMapping(value = "/file")
  2. public ResponseEntity<byte[]> getTableImageFile() throws IOException {
  3. byte[] imageFile = service.getImageFile();
  4. HttpHeaders httpHeaders = new HttpHeaders();
  5. httpHeaders.setCacheControl(CacheControl.noCache().getHeaderValue());
  6. httpHeaders.setContentType(MediaType.IMAGE_JPEG);
  7. httpHeaders.setContentLength(imageFile.length);
  8. return new ResponseEntity<>(imageFile, httpHeaders, HttpStatus.OK);
  9. }
  10.  
  11. @GetMapping(value = "/file", produces = MediaType.IMAGE_JPEG_VALUE)
  12. public ResponseEntity<byte[]> getTableImageFile() throws IOException {
  13. byte[] imageFile = service.getImageFile();
  14. return ResponseEntity.ok(imageFile);
  15. }
Add Comment
Please, Sign In to add comment