public void handleProfilePictureRequest(@PathVariable("id") Long id, HttpServletRequest req, HttpServletResponse resp) {
if (id == null) {
throw new IllegalArgumentException("An Identifier is required");
}
ProfilePicture researcherProfilePicture = researcherManager.getProfilePictureForThisResearcher(id);
if (researcherProfilePicture == null) {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
resp.setContentType(researcherProfilePicture.getMimeType());
InputStream in = null;
OutputStream out = null;
try {
resp.setContentLength((int) researcherProfilePicture.getBytes().length);
in = new ByteArrayInputStream(researcherProfilePicture.getBytes());
out = resp.getOutputStream();
byte[] buf = new byte[BYTE_BUFFER_SIZE];
int count = 0;
while ((count = in.read(buf)) >= 0) {