You will have something similar to this inside your sevlet
byte[] imageBytes = ...
response.setHeader("Content-Type", "image/jpg");// or png or gif, etc
response.setHeader("Content-Length", imageBytes.lenght);
response.getOutputStream().write(imageBytes);