在缓存Java小程序 [英] Caching in Java Applets

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

问题描述

Java小程序中什么样的方法可用于高速缓存?

据我了解,这构成了小程序的.jar将大多数浏览器缓存。


  • 是本作的小程序?
  • 使用的任何相关的.jar文件的情况下
  • 如果在运行时从远程URL小程序加载资源,它是
    正确的假设,这将不会被浏览器高速缓存?如果它
    不是由浏览器高速缓存,人们将能够实现缓存
    以书面形式向本地存储?


解决方案

  

愿意做这样的情况下,由小应用程序所使用的任何相关的.jar文件?


是,假设相关的JAR的缓存。


  

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


或许是肯定的。 JVM将可能直接连接到远程服务器,浏览器将无法看到HTTP请求。此外,JVM可能不知道浏览器的缓存组织或位置。然而,这一切依赖于平台。

另外,也可以是,JVM可以实现其自己的HTTP缓存。据我所知,目前这一代的Oracle的JVM不这样做,但不难想象,将来的可能。


  

如果它不是由浏览器高速缓存,人们将能够通过写本地存储实现缓存


只有当小程序被签名,并且用户已经接受了签名。一个小应用程序通常不能读取或写入本地存储。

What approaches are available for caching within a Java applet?

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

  • Will this be the case for any dependent .jars used by the applet?
  • 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? If it is not cached by the browser, would one be able to implement caching by writing to local storage?

解决方案

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

Yes, assuming that the dependent JARs are cacheable.

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?

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.

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小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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