Hi, With regards to my suggestion, I typically write these images to a directory that can be accessed through a standard http request or simple servlet. You can name these images something dynamic and not easily guessed. Maybe customer number + time stamp + .png, or user Id + timestamp + .png. Anyway, you get the idea. Return the image name/path to the client so they can request it either via standard http static resource request or via a servlet that extends HttpServlet. I tend to do the latter as it's just a simple Java servlet that handles the request for the download of resources. I do it this way because there is no need to use the power of Spring, JAX-WS, JAXB, CXF to return a simple image to a client. I can offload that work to a simple process and free up the mentioned frameworks to do what they're uniquely good at.
Oh, and btw, I run a regularly scheduled process to clean up that folder where I write the above mentioned images. Ron Grimes ________________________________________ From: cgswtsu78 [[email protected]] Sent: Wednesday, November 04, 2009 9:06 AM To: [email protected] Subject: RE: Return an Image from a REST webservice api Thank both of you for your replies, but I'm afraid I'm confused. If I create a BufferedImage, how can I return it to the client without streaming it? Since the rest web service isn't storing it anywhere but in memory, I don't understand how to get it back to the client who called the rest web service. I've tried to simply stream it from the rest web service, but I can't get access to the HttpServletResponse object as its always null. I've tried the below to get the HttpServletResponse without success. I'm calling the rest web service url directly from a link on jsp page that does a get on the rest web service url. Thanks for all of your help, greatly appreciated!
