0

Is there a simple, system-given way of advicing the browser to refresh each resource once after a fresh deployment of a war-file?

I know, that a filter can be used to set the required headers, but still I would need to implement the logic, taking care that each resource is at least refreshed once per client.

I.e. something like appending &deployment=2015-08-06-22-00-00 to EVERY (resource-)request performed? (this will make the browser cache the resources under the given parameter, thus refresh it after the next deployment, when the parameter has changed.)

Setting the No-Cache headers all the time is no option, because there is a huge amount of resources that would result in about 5 MB transfer amount (even gzip-encoded) per request.

I thought about using the "Expires" header for each resource, but unfortunatelly this would require to predict the next deployment n, whenever the deployment n-1 is released...

Currently the best option is to set the expiry time to 1d, cause deployments usually happen during the late hours of a day. However, if the system is running without an update for several weeks, this will cause unnecessary data-transfers per day and client...

dognose
  • 20,360
  • 9
  • 61
  • 107
  • Is this acceptable as dupe? http://stackoverflow.com/questions/18143383/how-to-use-jsf-versioning-for-resources-in-jar/ – BalusC Aug 07 '15 at 07:51
  • @BalusC It's not really a duplicate but the Custom ResourceHandler might be a good idea to handle this, as long as every include is a proper resource request and not vanilla-style. Thx for the link – dognose Aug 07 '15 at 09:54

1 Answers1

0

In case of small number of resources place them in a new folder, in our case js file changes are not getiing reflected after deployment, and now for each deployment js resources are placed in a new folder just to avoid this issue. In your case check the feasibility of keeping the resources in a new folder/location based on deploy version. will this help?

jikku
  • 641
  • 1
  • 6
  • 18
  • I think this might work for some projects - but for ours the number of resources is very large, so the script "relocating" the resources upon build would be a nightmare to maintain. – dognose Aug 06 '15 at 22:16