GWT *nocache* 并在 Jetty 7 中部署应用程序

发布于 2025-01-04 14:24:22 字数 501 浏览 4 评论 0原文

这个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰◇生如夏花灿烂 2025-01-11 14:24:22

此答案显示了如何禁用/启用 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文