This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes Invalidating image cache when using h:graphicImage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Invalidating image cache when using h:graphicImage" Watch "Invalidating image cache when using h:graphicImage" New topic
Author

Invalidating image cache when using h:graphicImage

Jay pratt
Greenhorn

Joined: Oct 29, 2010
Posts: 2
I'm working with an app that uses JSP 2 and JSF 1.2. There are many uses of h:graphicImage like so:
<h:graphicImage value="/img/foo.gif" />
<h:graphicImage url="#{request.contextPath}/img/bar.gif" />

The response headers tell the browser to cache the image, but there is currently no way of invalidating the cache. The workaround is to rename the images when they are change. I'd like to figure out how to patch h:graphicImage so that it can add a cache version string to the resuting <img> src attribute like this:
<img src="/img/foo.gif?cache=201011040801" />

One solution is to go through all the JSP pages and add this in, but I'm hoping for a transparent solution. My initial attempts at creating a custom renderer have failed, but here is what I was trying:



Has anyone else solved this problem with the graphicImage tag?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalidating image cache when using h:graphicImage