简体   繁体   English

JSF在“部署”后刷新

[英]JSF refresh after “deployment”

Is there a simple , system-given way of advicing the browser to refresh each resource once after a fresh deployment of a war -file? 是否有一种简单的系统提供的方法来建议浏览器在重新部署war文件后刷新每个资源一次?

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. 我知道,可以使用filter来设置所需的标头,但是我仍然需要实现逻辑,注意每个客户端至少刷新一次每个资源。

Ie something like appending &deployment=2015-08-06-22-00-00 to EVERY (resource-)request performed? 即类似于将&deployment=2015-08-06-22-00-00附加到执行的每个(资源-)请求中吗? (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. 始终设置No-Cache标头是不可行的,因为存在大量资源,每个请求将导致大约5 MB的传输量(甚至是gzip编码)。

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... 我考虑过为每个资源使用“ Expires”标头,但是不幸的是,每当发布部署n-1时,这都需要预测下一个部署n

Currently the best option is to set the expiry time to 1d, cause deployments usually happen during the late hours of a day. 当前,最好的选择是将到期时间设置为1d,因为部署通常发生在一天的深夜。 However, if the system is running without an update for several weeks, this will cause unnecessary data-transfers per day and client... 但是,如果系统连续数周未进行更新运行,则每天和客户端的数据传输都将不必要。

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. 如果资源较少,则将它们放置在新文件夹中,在我们的案例中,部署后js文件的更改不会得到反映,现在对于每个部署js资源都放置在新文件夹中,只是为了避免此问题。 In your case check the feasibility of keeping the resources in a new folder/location based on deploy version. 根据您的情况,检查根据部署版本将资源保留在新文件夹/位置中的可行性。 will this help? 这会有所帮助吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM