Last active
December 14, 2015 22:09
-
-
Save joshlong/5156263 to your computer and use it in GitHub Desktop.
reading a user's profile photo
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
| @RequestMapping(value = USER_COLLECTION_ENTRY_PHOTO_URL, method = RequestMethod.GET) | |
| public ResponseEntity<byte[]> renderMedia(@PathVariable("userId") Long userId) throws Throwable { | |
| InputStream is = userService.readUserProfilePhoto(userId); | |
| HttpHeaders httpHeaders = new HttpHeaders(); | |
| httpHeaders.setContentType(MediaType.IMAGE_JPEG); | |
| byte buffer[] = IOUtils.toByteArray(is); | |
| return new ResponseEntity<byte[]>(buffer, httpHeaders, HttpStatus.OK); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment