如何修改 JBoss 提供的静态文件上的 http-headers

发布于 2024-07-09 09:28:16 字数 532 浏览 6 评论 0原文

我有一个 Web 应用程序 (.war),其中包含一些静态文件(例如 MS Word 文档)。 当我尝试下载这些文件时,JBoss 会自动在响应中设置一些 HTTP 标头。 有没有办法配置 JBoss(版本 3.2.7)将这些标头设置为特定值(或省略它们)? 我对标头特别感兴趣

Cache-Control: no cache

,因为当使用 Internet Explorer 通过 https 下载文件时,这会导致一些问题(IE 将拒绝将文件保存到磁盘)。

顺便提一句。 这种行为可以通过在 Windows 注册表中添加一个条目来改变:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"BypassSSLNoCacheCheck"=dword:00000001

但显然我不会要求客户只是为了下载文件而修改他们的注册表。

非常感谢任何建议。

I have a web application (.war) that contains some static files (e.g. MS word documents). When I try to download these files, JBoss automatically sets some HTTP-headers in the response. Is there a way to configure JBoss (version 3.2.7) to set these headers to specific values (or omit them)?
I'm especially interested in the

Cache-Control: no cache

header, because this leads to some problems when downloading files over https with Internet Explorer (IE will refuse to save the file to disk).

Btw. this behaviour can be changed by adding an entry to the windows registry:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"BypassSSLNoCacheCheck"=dword:00000001

but obviously I'm not going to ask customers to fiddle with their registry just to donwload a file.

Any suggestions are greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

本王不退位尔等都是臣 2024-07-16 09:28:16

这里是 JBoss 社区 wiki 上关于如何禁用缓存的描述 -控制行为。

直到现在我才知道 IE6 的这个功能。 这也适用于 IE7 吗?

Here is a description on the JBoss community wiki on how to disable the Cache-Control behaviour.

I wasn't aware of this IE6 feature until now. Does this also apply to IE7?

小耗子 2024-07-16 09:28:16

我想到的一个选项是在它周围包装一个 servlet(或类似的) - 以便被调用的 URL 调用您的 servlet,然后设置您想要的标头,然后传递底层文档。

An option that comes to mind is to wrap a servlet (or similar) around it - so that the URL that gets called calls your servlet, which then sets the headers you want and then delivers the underlying document.

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