0
我們的客戶使用IE8,並且它的緩存方式讓事情變得困難。爲了解決這個問題,我添加一個bean以防止緩存406中的無緩存結果?
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="cacheSeconds" value="0" />
</bean>
根據Chrome的(非常有用)的開發工具,我可以看到響應頭是:
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,但我已經使用傑克遜。