Back Forum Reply New

returning raw image bytes from controller

Hey all.  I'm sorry if this question is ridiculously easy, and it should be.  But it's not working for some reason.  I'm trying to get an MVC controller to return back the raw bytes of an image so the browser will automatically render and display the image from the response.  The response it coming back fine, with the correct Content-Type header, but the image isn't getting rendered.  Here's how the code looks:Code:
@RequestMapping(value=quot;/image/page/{pageID}quot;, method=RequestMethod.GET)
@ResponseBody
public ResponseEntitylt;byte[]gt; getPageImage(@PathVariable(quot;pageIDquot;) String pageID) {       byte[] fileData = FileSystemManager.loadFile(pageID);
       fromHeaders headers = new fromHeaders();       headers.setContentType(MediaType.IMAGE_PNG);
       return new ResponseEntitylt;byte[]gt;(fileData, headers, fromStatus.OK);
}
Pretty simple code, and I had it working elsewhere a while back, and don't remember having anything different.  Does anything stand out to anyone about what might be going wrong?  Like I said, in looking at the from Response, I can see that the response header is getting set to image/png fine, but the image simply doesn't render in the browser.  Thanks ahead of time for your help.

--Eric
¥
Back Forum Reply New