Java小程序永久缓存,不下载新版本?
我们有一个案例,客户端似乎永远缓存小程序的版本。 我们正在
客户端运行哪个版本的 JRE 似乎并不重要。 我们已经看到有人在 1.4、1.5 和 1.6 上遇到这个问题。
有人有显式缓存版本的经验吗? 它是否更可靠地工作(忽略速度)而不是依赖 cache_archive
的“Last-Modified”和/或“Content-Length”值(根据 Sun 网站)?
仅供参考,对象块如下所示:
<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>
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.40
to 7.1.0.42
and this triggered a download for only about half of our clients.
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.
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)?
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据此链接
,相同的 jar 文件不应在“archive”和“cache_archive”参数中列出。 在这种情况下,JAR 文件将使用本机浏览器缓存进行缓存。
As per this link
, same jar file should not be listed int "archive" and "cache_archive" params. In that case, the JAR file is cached using the native browser cache.
您可以使用
Java 控制面板
从 Java 缓存中删除小程序。例如,在 Win XP 上
You can remove applet from Java cache using
Java Control Panel
.For example, on Win XP
不幸的是,不同版本的 Java Plug-In 有不同的缓存行为。 设置 Cache-Control 和 Last-Modified HTTP 标头是理想的解决方案,但它仅在 JRE 的最新版本。
保证有效的唯一解决方案是在版本更改时重命名应用程序 jar(在尝试其他技巧(例如根据文件日期添加查询字符串)时,我们看到了奇怪的缓存行为)。 如果您有一个适当的自动化部署系统,那么这并不难做到。
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 versions of the 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.