Documentation Contents

Applet Caching in Java Plug-in

Applet caching ensures that applets are not unnecessarily downloaded by a browser every time a user references them. Java Plug-in has supported caching in previous versions by using the same cache the browser uses for all other web documents.

This works for casual applet usage, but larger applets can often get flushed from the cache to make room for other documents since the browser has no knowledge that an applet file might be needed in the future. The result is that this caching strategy fails where is needed most in large business applets.

This release introduces an alternative form of applet caching which allows an applet deployer to decide her applet should be "sticky", that is, to stay on the disk in a secondary cache which the browser cannot overwrite. The only time "sticky" applets get downloaded after that is when they are updated on their server. Otherwise the applet is always available for quick loading. We recommend that applets which provide core business applications be made sticky to improve their startup performance.

This new feature is activated by including the new PARAM NAME="cache_option" and PARAM NAME="cache_archive" values in the tag that specifies the use of Java Plug-in as below:

<OBJECT ....>
         <PARAM NAME="archive" VALUE="...">
         ....
         <PARAM NAME="cache_option" VALUE="...">
         <PARAM NAME="cache_archive" VALUE="...">
</OBJECT>

The cache_option attribute can take one of three values:

No
Disable applet installation. Always download the file from the web server.
Browser
Run applets from the browser cache (default).
Plugin
Run applets from the new Java Plug-in cache.

The cache_archive attribute contains a list of the files to be cached:

<PARAM NAME="cache_archive" VALUE="a.jar,b.jar,c.jar">

Like the archive attribute in the APPLET tag, the list of jar files in the cache_archive attribute do not contain the full URL, but are always downloaded from the codebase specified in the EMBED/OBJECT tag.

Note that the list of JAR files in the cache_archive attribute and those in the archive attribute may be similar but should not contain the same JAR files. There are two possible cases:

  1. A JAR file is listed in cache_archive but not in archive. In this case, the JAR file is cached according to cache_option.
  2. A JAR file is listed in archive but not in cache_archive. In this case, the JAR file is cached using the native browser cache. This guarantees a minimum of caching.
cache_option and cache_archive can only be specified once per EMBED/OBJECT tag. In addition, both attributes must be specified. If either cache_archive or cache_option are missing, Java Plug-in will treat the applet normally using the archive attribute.

Note: Caching of the JAR files specified in the manifest's CLASSPATH variable using Java Plug-in's cache is currently not supported.


Copyright © 1993, 2010, Oracle and/or its affiliates. All rights reserved.

Please send comments using this Feedback page.
Oracle Corporation and/or its affiliates
Java Technology