image-download - wrapping resource inside response entity
This commit is contained in:
parent
d2ca517fde
commit
fe22d59d06
@ -57,7 +57,9 @@ public class ImageController {
|
|||||||
|
|
||||||
@RequestMapping(value = "/image-resource", method = RequestMethod.GET)
|
@RequestMapping(value = "/image-resource", method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Resource getImageAsResource() {
|
public ResponseEntity<Resource> getImageAsResource() {
|
||||||
return new ServletContextResource(servletContext, "/WEB-INF/images/image-example.jpg");
|
final HttpHeaders headers = new HttpHeaders();
|
||||||
|
Resource resource = new ServletContextResource(servletContext, "/WEB-INF/images/image-example.jpg");
|
||||||
|
return new ResponseEntity<>(resource, headers, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user