设置一个过滤器,将响应标头设置为仅图像文件
根据我在此链接中的讨论,我遇到了缓存问题,
但是我我不知道如何处理在 Spring MVC 上设置响应标头的建议。
有谁知道如何设置某种过滤器,仅在图像文件上添加响应标头?
我目前不是使用 SPring MVC 进行 J2EE Web 开发的专家。
有什么想法吗?
I am having a caching problem based on the discussion that I have in this link
But I am not sure how to go about with the suggestion on setting the response headers on my Spring MVC.
Does anybody know how to setup a some sort of a filter that will add add a response header only on image files?
I currently am not an expert on J2EE web development with SPring MVC.
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Spring 附带了一个资源 Servlet。
我们正在使用一个ear文件,我的所有资源都在耳朵的一个罐子里。如果您仅部署 WAR 文件(可能部署到 tomcat),则尝试将资源放入 jar 中,并将该 jar 放入 WAR 文件的 /WEB-INF/lib 目录中。
如果您将资源(在 jar 内)存储在以下目录中:
对资源的请求将如下所示:
Spring comes with a Resources Servlet.
We are using an ear file and all of my resources are in a jar in the ear. If you are only deploying a WAR file (perhaps to tomcat), then try putting your resources in a jar and putting the jar in your WAR file's /WEB-INF/lib directory.
If you store your resources (inside the jar) in the following directory:
requests for your resources will look something like this: