GWT *nocache* 并在 Jetty 7 中部署应用程序
在 这个 gwt web 中,要放置一个 *.htaccess 配置文件,如下所示避免缓存主 javascript gwt 应用程序。
<Files *.nocache.*>
ExpiresActive on
ExpiresDefault "now"
Header merge Cache-Control "public, max-age=0, must-revalidate"
</Files>
<Files *.cache.*>
ExpiresActive on
ExpiresDefault "now plus 1 year"
</Files>
有没有办法对 Jetty 做同样的事情? (无需使用httpd jetty模块)
In this gwt web says to place a *.htaccess config file like this to avoid caching main javascript gwt application.
<Files *.nocache.*>
ExpiresActive on
ExpiresDefault "now"
Header merge Cache-Control "public, max-age=0, must-revalidate"
</Files>
<Files *.cache.*>
ExpiresActive on
ExpiresDefault "now plus 1 year"
</Files>
Is there a way to do the same with Jetty ? (whithout needing to use httpd jetty module)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此答案显示了如何禁用/启用 Jetty 提供的所有文件的缓存:
如何防止在嵌入式 Jetty 实例中缓存静态文件?
我认为要为单个文件设置自定义缓存设置(例如 nocache),必须使用过滤器并在 HttpResponseObject 中为与请求 URI 匹配的文件手动设置标头,例如此处描述:
用于浏览器缓存的 Servlet 过滤器?
This answer shows how to disable/enable caching for all files served with Jetty:
How to prevent caching of static files in embedded Jetty instance?
I think to set up custom caching settings for individual files (e.g. nocache), one must use a filter and set the headers manually in the HttpResponseObject for files matching the request URI such as described here:
Servlet filter for browser caching?