Java Applet 中的缓存 [英] Caching in Java Applets

查看:26
本文介绍了Java Applet 中的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有哪些方法可用于在 Java 小程序中进行缓存?

What approaches are available for caching within a Java applet?

我认为构成小程序的 .jar 将被大多数浏览器缓存.

I gather that the .jar that makes up the applet will be cached by most browsers.

  • Applet 使用的任何依赖 .jar 文件都会出现这种情况吗?
  • 如果小程序在运行时从远程 URL 加载资源,是不是假设这不会被浏览器缓存是否正确?如果它没有被浏览器缓存,是否可以实现缓存通过写入本地存储?

推荐答案

Applet 使用的任何依赖 .jar 文件都会出现这种情况吗?

Will this be the case for any dependent .jars used by the applet?

是的,假设依赖的 JAR 是可缓存的.

Yes, assuming that the dependent JARs are cacheable.

如果小程序在运行时从远程 URL 加载资源,假设它不会被浏览器缓存是否正确?

If the applet loads resources from a remote URL at runtime, is it correct to assume that this will not be cached by the browser?

可能是的.JVM 可能会直接连接到远程服务器,浏览器将看不到 HTTP 请求.此外,JVM 可能不知道浏览器的缓存组织或位置.但是,这完全取决于平台.

Probably yes. The JVM will probably connect directly to the remote server, and the browser won't see the HTTP request. In addition, the JVM will probably be unaware of the browser's cache organization or location. However, this is all platform dependent.

JVM 也有可能实现自己的 HTTP 缓存.AFAIK,当前一代的 Oracle JVM 没有,但未来的可能不会.

It is also possible that the JVM could implement its own HTTP cache. AFAIK, current generation Oracle JVMs don't, but it is not inconceivable that future ones might.

如果不是浏览器缓存,是否可以通过写入本地存储来实现缓存?

If it is not cached by the browser, would one be able to implement caching by writing to local storage?

仅当小程序已签名且用户已接受签名时.小程序通常无法读取或写入本地存储.

Only if the applet is signed, and the user has accepted the signature. An applet normally can't read or write local storage.

这篇关于Java Applet 中的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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