Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @GetMapping(value = "/file")
- public ResponseEntity<byte[]> getTableImageFile() throws IOException {
- byte[] imageFile = service.getImageFile();
- HttpHeaders httpHeaders = new HttpHeaders();
- httpHeaders.setCacheControl(CacheControl.noCache().getHeaderValue());
- httpHeaders.setContentType(MediaType.IMAGE_JPEG);
- httpHeaders.setContentLength(imageFile.length);
- return new ResponseEntity<>(imageFile, httpHeaders, HttpStatus.OK);
- }
- @GetMapping(value = "/file", produces = MediaType.IMAGE_JPEG_VALUE)
- public ResponseEntity<byte[]> getTableImageFile() throws IOException {
- byte[] imageFile = service.getImageFile();
- return ResponseEntity.ok(imageFile);
- }
Add Comment
Please, Sign In to add comment