One way to do this without changing the HTTP protocol, is to pack all those different files into a single archive file, perhaps a zip archive, and just download that.
We aren't quite there yet. Browsers do not yet
understand archive files, but in Java 1.1 applets do. You can pack all the
images, sounds, and .class files an applet needs into one JAR archive
and load that instead of the individual files.
Applet classes do not have to be loaded directly. They can also be stored in JAR archives. To do this you use the ARCHIVES
attribute of the APPLET
tag
<APPLET CODE=HelloWorldApplet WIDTH=200 HEIGHT=100 ARCHIVES="HelloWorld.jar">
<hr>
Hello World!
<hr>
</APPLET>
In this example, the applet class is still HelloWorldApplet
. However,
there is no HelloWorldApplet.class file to be downloaded. Instead the class
is stored inside the archive
file HelloWorld.jar. Sun provides a tool for creating JAR archives with its JDK 1.1. For example,
% jar cf HelloWorld.jar *.class
This puts all the .class files in the current directory
in the file named "HelloWorld.jar". The syntax
of the jar command is deliberately similar to the Unix tar command.