开发者

How do I stop Safari from caching my Servlet response?

开发者 https://www.devze.com 2023-01-04 02:40 出处:网络
I\'m having trouble testing a web app with Safari. My app returns wave audio data. The problem happens when I change the application and hit it again开发者_C百科 from Safari. Safari caches the origina

I'm having trouble testing a web app with Safari. My app returns wave audio data. The problem happens when I change the application and hit it again开发者_C百科 from Safari. Safari caches the original response so no matter how many times I hit refresh it seems like I've not updated anything. I can almost get around this using force refresh with Firefox but because I'm having trouble generating the wave headers using the javax.sound API Firefox only plays the first second of audio returned. A few weeks ago I tried setting the HTTP header in my servlet to prevent caching but I don't think I was setting it correctly. (What is the header for browser cache control?) This is becoming a real pain and I'm looking for any ideas, comments, or alternative approaches. I'm getting ready to try again but I figured I'd ask here in the interim to see if someone can provide help.


I found my answer. I just added a combination of "Pragma: no-cache", "Cache-Control: no-cache", and "Expires: -1" to y response headers. Now it appears the caching is no more. I still need a solution for my broken wave headers. I really hate to engineer a wave/io package for something that should be straight forward.

0

精彩评论

暂无评论...
验证码 换一张
取 消