Web Browsers and Handlers
The content- and protocol-handler mechanisms we’ve introduced can be used by any application that accesses data via URLs. This mechanism is extremely flexible; to handle a URL, you need only the appropriate protocol and content handlers. One obvious application is for Java-based web browsers that can handle new and specialized kinds of URLs.
Furthermore, Java’s ability to load new classes over the Net means that, in theory, the handlers don’t even need to be owned by the browser. Content and protocol handlers could be downloaded over the Net from the same site that supplies the data, and used by the browser. If you wanted to supply some completely new data type, using a completely new protocol, you could make your data file plus a content handler and a protocol handler available on your web server; anyone using a Web browser supporting Java could automatically get the appropriate handlers whenever they access your data. In short, Java could allow you to build dynamically extensible web applications. Instead of gigantic do-everything software, you could build a lightweight scaffold that dynamically incorporates extensions as needed.
Figure 12.1 shows the conceptual operation of a downloadable content handler in a web browser; Figure 12.2 does the same for a protocol handler.

Figure 12-1. A content handler at work
Figure 12-2. A protocol handler at work
Unfortunately, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access