I have a textures.jar file on my server (specified with the archive parameter within the applet tag) with a class to use as an anchor and some images. When I run the applet, this is how I get to the images:
Does this mean that every time I use a getResource() on an applet it goes to the server for it?
No. Generally the Java Plugin will cache jar files. When the applet is loaded the Plugin checks whether the file on the server is newer than the one in the cache; if it is, it will replace the existing cached copy, but otherwise the cached copy will be used.
Note that the user can turn off jar file caching in the Plugin control panel, but by default it's turned on (and most users probably never touch those settings).
Joined: Mar 11, 2003
Thank you for the quick reply, Ulf.
I do know that the jar files are cached by default.
I just want o know how to access the resources contained within them (the cached version, if available) as opposed to always connecting to the server version of the files.
I also want to know if this is the default behavior of applets (that is to access server resources instead of local cached resources with the getResource method) or if I'm doing something wrong.
Joined: Mar 22, 2005
I don't quite follow. Are you saying that the jar file is retrieved every time despite caching being turned on?
subject: Applet getResource() from Server or Client?