【问题标题】:No-Cache Results in 406?406 中的无缓存结果?
【发布时间】:2012-11-27 18:02:55
【问题描述】:

我们的客户端使用 IE8,它需要大量缓存的方式让事情变得困难。为了解决这个问题,我添加了一个 bean 来防止缓存

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
    <property name="cacheSeconds" value="0" />
</bean>

根据 Chrome 的(非常有用的)开发者工具,我可以看到 Response Headers 是:

Cache-Control:no-cache
Cache-Control:no-store
Content-Length:1070
Content-Type:text/html;charset=utf-8
Date:Tue, 27 Nov 2012 17:21:31 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:no-cache

但是,现在我收到了406 回复。为什么我会得到这个?

请求标头是:

Accept:application/json, text/javascript, */*; q=0.01
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Cookie:redacted
Host:localhost:8040
Referer:http://localhost:8040/redacted
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11
X-Requested-With:XMLHttpRequest

我看了this answer,但我已经在使用Jackson了。

【问题讨论】:

    标签: spring browser-cache


    【解决方案1】:

    找到答案。再一次,如何订购豆子是个问题。如果我将 no-cache bean 放在 jackson bean 之后,那么它可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-07
      • 2016-11-27
      • 2018-04-08
      • 1970-01-01
      • 1970-01-01
      • 2011-01-06
      • 1970-01-01
      相关资源
      最近更新 更多