I have been experimenting with deployJava() / caching and I think I may have it working. I wanted to share this with the community and see if anyone may have any suggestions or comments:
Add this code exactly in the same place the where the <applet> tag would normal appear in the html:
<script>
var attributes = {codebase:"/jscripts/jprint/jZebra1.4.7/dist",
code:"jzebra.PrintApplet.class",
archive:"jzebra.jar",
name: "jzebra",
cache_option:"plugin",
cache_archive:"jzebra.jar",
cache_version:"0.1.4.7",
width:50,
height:50} ;
var parameters = {printer:"zebra"} ;
var version = "1.6" ;
deployJava.runApplet(attributes, parameters, version);
</script>
Watching the console is interesting. The first time this is run the console says things like:
security: Loading Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
security: Loaded Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
security: Loading SSL Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
security: Loaded SSL Root CA certificates from C:\Program Files (x86)\Java\jre7\lib\security\cacerts
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
Content-Length: 55,410
Content-Encoding: null
So you can see the JVM is opening a connection to the web server and pulling down the jar file and then caching on the local file system.
The next time deployJava is run (even from a different browser page) the console says:
network: Created version ID: 0.1.4.7
The JVM skips the network communication to download the jar files and uses the cached version. (nice!)
I think this is going in the right direction. A few things I would like to learn:
1. What does prevalidated=false/0 mean?
2. Is there a way to dynamically deployJava() so that the applet tag can be added to DOM only when needed?