问题描述
我部署的 Java 小程序出现问题,该小程序拒绝缓存在 jvm 的粘性"缓存(或浏览器)中.出于某种原因,每次用户加载此小程序所在的页面时,jvm 都会从服务器重新下载 jar 文件,从而导致长时间延迟.
I'm having a problem with a Java applet I've deployed that is refusing to be cached in the jvm's "sticky" cache (or by the browser). For some reason every time a user loads the page this applet is on, the jvm re-downloads the jar file from the server which causes a long delay.
包含小程序的网页正在通过互联网访问,因此根据 Sun 的 Java 小程序文档 我使用的是 标签而不是
或
标签.
The webpage containing the applet is being accessed via the internet, so according to Sun's Java applet documentation I'm using an <applet>
tag rather than an <object>
or <embed>
tag.
对调试或识别问题的任何帮助将不胜感激.
Any help debugging or identifying the problem would be much appreciated.
以下是我使用的完整小程序标签:
Below is the full applet tag I'm using:
<applet alt="Scanning Applet failed to load" archive="scanning.jar"
code="scanning.scanlet.class" codebase="/java/" codetype="application/java"
height="30" mayscript="True" name="scanlet" width="200">
<param name="domain" value="192.168.12.23" />
<param name="publishName" value="scan_attachment" />
<param name="publishURL" value="http://192.168.12.23/draft/update/52" />
<param name="curURL" value="http://192.168.12.23/draft/edit/52" />
Your browser is unable to process the Java <APPLET> tag needed to display this applet
<br />
One solution would be to download a better web browser like
<a href="http://www.mozilla.com/firefox">Mozilla's Firefox</a>
</applet>
推荐答案
我遇到了同样的问题,并发现了一个需要在服务器端应用的技巧.如果 jar 的 mime 类型不正确,它们似乎不会被缓存.请使用 application/java-archive mime 类型检查您的服务器回复.
I had the very same problem and found a trick that need to be applied server side. It seems that jars aren't cached if their mime type is incorrect. Please check your server reply using the application/java-archive mime type.
我发现的另一个问题与特定的 jar 有关.我的存档参数列出了许多 jar,但只有少数被缓存.我发现所有 jars 都缓存到一个特定的 jars,所有剩余的 jars 根本没有缓存.在加载小程序时,我在它的 Java 控制台中按下了5",并在最后一个缓存的 jar 之后发现了这条消息: cache: signed entry missing from jar .我仍然不知道这个文件有什么问题,但我在存档参数列表的末尾移动了那个 jar.这修复"了问题.
Another problem I found is related to a specific jar. My archive parameter was listing many jars, but only a few were cached. I found that all jars upto a specific one where cached, all remaining jars weren't cached at all.While loading applet, I pressed "5" in its java console and found this message just after the last cached jar: cache: signed entry missing from jar . I still don't know what is wrong with this file, but I moved that jar at the end of the archive parameter list. This "fixed" the problem.
这篇关于Java Applet 不缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!