Java小程序永久缓存,不下载新版本? [英] Java applet cached forever, not downloading new version?

查看:27
本文介绍了Java小程序永久缓存,不下载新版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个案例,客户端似乎永远缓存小程序版本.我们在 标签中正确使用了 <param name="cache_version"> 标签,或者我们认为.我们从 7.1.0.40 的版本字符串变成了 7.1.0.42,这触发了我们大约一半客户的下载.

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.

客户端运行的 JRE 版本似乎无关紧要.我们已经看到有人在 1.4、1.5 和 1.6 上遇到过这个问题.

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.

有人对显式缓存版本有经验吗?它是否更可靠地工作(忽略速度)而不是依赖 cache_archive 的Last-Modified"和/或Content-Length"值(根据 Sun 的网站)?

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>

推荐答案

遗憾的是,不同版本的 Java 插件具有不同的缓存行为.设置 Cache-Control 和 Last-Modified HTTP 标头是理想的解决方案,但它仅适用于 JRE 的最新版本.

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.

唯一保证有效的解决方案是在版本更改时重命名应用程序 jar(在尝试其他技巧时,例如根据文件日期添加查询字符串时,我们看到了奇怪的缓存行为).如果您有一个适当的自动化部署系统,这并不难做到.

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.

这篇关于Java小程序永久缓存,不下载新版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆