java Java小程序永久缓存,不下载新版本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/66875/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java applet cached forever, not downloading new version?
提问by MtotheThird
We have a case where clients seem to be eternally caching versions of applets. We're making use of the <param name="cache_version">tag correctly within our <object>tag, or so we think. We went from a version string of 7.1.0.40to 7.1.0.42and this triggered a download for only about half of our clients.
我们有一个案例,客户似乎永远缓存小程序版本。我们<param name="cache_version">在我们的标签中正确使用了<object>标签,或者我们认为。我们从7.1.0.40to的版本字符串开始7.1.0.42,这仅触发了大约一半客户的下载。
It doesn't seem to matter which version of the JRE the client is running. We've seen people have this problem on 1.4, 1.5 and 1.6.
客户端运行的 JRE 版本似乎无关紧要。我们已经看到人们在 1.4、1.5 和 1.6 上遇到这个问题。
Does anybody have experience with explicit cache versions? Does it work more reliably (ignoring speed) to instead rely on the cache_archive's "Last-Modified" and/or "Content-Length" values (as per Sun's Site)?
有没有人有使用显式缓存版本的经验?它是否更可靠地工作(忽略速度)而不是依赖于cache_archive“上次修改”和/或“内容长度”值(根据Sun 的站点)?
FYI, object block looks like this:
仅供参考,对象块如下所示:
<object>
<param name="ARCHIVE" value="foo.jar">
<param name="CODE" value="com.foo.class">
<param name="CODEBASE" value=".">
<param name="cache_archive" value="foo.jar">
<param name="cache_version" value="7.1.0.40">
<param name="NAME" value="FooApplet">
<param name="type" value="application/x-java-applet;jpi-version=1.4.2_13">
<param name="scriptable" value="true">
<param name="progressbar" value="true"/>
<param name="boxmessage" value="Loading Web Worksheet Applet..."/>
</object>
回答by MtotheThird
Unfortunately, different versions of the Java Plug-In have different caching behaviors. Setting your Cache-Control and Last-Modified HTTP headers is the ideal solution, but it only works under the most recent versionsof the JRE.
不幸的是,不同版本的 Java Plug-In 具有不同的缓存行为。设置 Cache-Control 和 Last-Modified HTTP 标头是理想的解决方案,但它仅适用于最新版本的 JRE。
The only solution GUARANTEED to work is to rename your application jars when their versions change (we've seen strange caching behavior when trying other tricks like adding query strings based on file dates). This isn't so difficult to do if you have a properly automated deployment system.
唯一保证有效的解决方案是在版本更改时重命名应用程序 jar(在尝试其他技巧时,例如根据文件日期添加查询字符串时,我们看到了奇怪的缓存行为)。如果您有一个适当的自动化部署系统,这并不难做到。
回答by Ilya
You can remove applet from Java cache using Java Control Panel.
For example, on Win XP
您可以使用Java Control Panel.
例如,在 Win XP 上
Start -> Control Panel -> Java -> Temporary Internet Files[View]

