Hi guys, probably a very easy question, but google has failed to come up with a decent answer for me

I need to create an image from a URL in my controller and pump it back out via a servlet outputstream.

I currently do this

byte[] pictureBytes = applicant.getProfileImage();
String pictureExtention = "image/" + applicant.getProfileImageExtention();
ServletOutputStream servletOutputStream = response.getOutputStream();
response.setContentType(pictureExtention);
response.setContentLength(pictureBytes.length);
servletOutputStream.write(pictureBytes, 0, pictureBytes.length);
servletOutputStream.flush();
servletOutputStream.close();

however if applicant.getProfileImage() == null I would like to reutrn the image located at images/noProfileImage.jpg

Please help!

Warm regards,

Werda