Prevent Java Applet classloader from attempting remote retrieval of classes
I've noticed that when a Java Applet is executed, the classloader seems to be hitting the web server with a literal deluge of requests for stuff that should already be in the applet's jar file, or stuff that nobody needs. Classes, properties files, BeanInfo for each and every class in the applet, you name it. It seems this is actually fully intentional, apparently supposed to allow for providing updates to individual files within th开发者_如何学Ce jar without having to replace the entire jar - so the classloader first tries to retrieve the file remotely, and only if that fails it deigns to use the local copy it already has.
I find that highly annoying and wasteful, the web server keeps getting hammered by useless requests it has to deny. Isn't there a way to invert the default behaviour, i.e. to tell the class loader to use the local copy first and only once the desired resource can't be found locally, try to fetch it remotely? Would it be too much to hope for that there might some kind of system property I just have to set, or do I actually have to write a replacement class loader to accomplish this?
Files should be read from the archives first. To suppress loose file lookups that should fail, there is an option for that:
<PARAM name="codebase_lookup" value="false">
http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/special_attributes.html#codebase
精彩评论