How can I emulate forward on 404 in jersey?

Posted by koppor on Stack Overflow See other posts from Stack Overflow or by koppor
Published on 2012-04-01T17:25:19Z Indexed on 2012/04/01 17:30 UTC
Read the original article Hit count: 171

Filed under:
|

I have a picture on a given URL. The picture might need a referesh. I want to do the freshness-check at the time of the request. Therefore, I coded a jersey resource handling the request on the picture URL. It refreshes the picture on the filesystem if necessary. I do not want to re-code a caching mechansim, but rely on tomcat's implementation. Therefore, I would like to "forward" the request in the internal handler chain. I tried return new Viewable(sb.toString());, but a viewable is not a picture. What return type can I use?

I could let the concrete picture reside on another URL and send a 307 (Temporary Redirect). Always sending that as answer seems odd to me.

Related question: How to return a PNG image from Jersey REST service method to the browser

© Stack Overflow or respective owner

Related posts about tomcat

Related posts about jersey