I\'ve tried the various ways given in Stackoverflow, maybe I missed something.
I have an Android client (whose code I can\'t change) which is currently getting an im
I believe this should work:
@RequestMapping(value = "/Image/{id:.+}", method = RequestMethod.GET)
public ResponseEntity getImage(@PathVariable("id") String id) {
byte[] image = imageService.getImage(id);
return ResponseEntity.ok().contentType(MediaType.IMAGE_JPEG).body(image);
}
Notice that the content-type is set for ResponseEntity, not for HttpServletResponse directly.