CONTENTS | PREV | NEXT | The Java Language Environment |
The basic structure of HotJava is instructive. It is easiest understood from the operation of Mosaic: Mosaic starts with a URL and fetches the object referenced by that URL using the specified protocol. The host and localinfo fields are passed to the protocol handler. The result of this is a bag of bytes containing the object that has been fetched. These bytes are inspected to determine the type of the data (HTML document or JPEG image, for example). From this type information, code is invoked to manipulate and view the data.That's all there is to Mosaic. It's essentially very simple. But despite this apparent simplicity, the Mosaic program is actually huge since it must contain specialized handlers for all of these data types. It's bundled together into one big monolithic lump.
In contrast, HotJava is very small, because all of the protocol and data handlers are brought in from the outside. For example, when it calls the protocol handler, instead of having a table that has a fixed list of protocols that it understands, HotJava instead uses this type string to derive a Java language class name. The protocol handler for this type is dynamically linked in if it is missing. They can be linked in from the local system, or they can be linked in from definitions stored on the host where the URL was found, or anywhere else on the net that HotJava suspects might be a good place to look. In a similar fashion, HotJava can dynamically locate and load the code to handle different types of data objects and different ways of viewing them.