3

I built a web application using Apache Struts2 and need to version static resources in order to enable caching inside browsers. I have all the resources checked into Subversion.

Is there a solution possible, such that Maven checks-out the static resources at the build time and reads the latest SVN revision number of a static file and accordingly add version number in it's URL and replace it inside the HTML templates using filter properties?

Quaternion
  • 10,380
  • 6
  • 51
  • 102
VarunGupta
  • 6,127
  • 5
  • 27
  • 31
  • An alternative to your solution would be to use httpd/nginx in front of your servlet container. They will automatically handle caching using a combination of etag and last-modified headers. – Sahil Muthoo Mar 21 '12 at 10:11
  • Sure. Caching can be taken care of by the web server but browser anyways sends the request to see a no-change response which is one request wasted. To avoid this request, is to set Expires header, in which case, the image/js/css file needs to be renamed every time it is modified. – VarunGupta Mar 21 '12 at 10:42
  • Yes ofcourse the browser will have to make a conditional GET. Though this issue can be mitigated with packing of static assests in a single bundle. – Sahil Muthoo Mar 21 '12 at 13:35

0 Answers0