The Mozilla
Organization
Our Mission
Who We Are
Getting Involved
Community
Editorials
What's New
Newsbot
Development
Roadmap
Module Owners
Blue Sky
Projects
Status
Tools
Products
Source Code
Binaries
Documentation
License Terms
Bug Reports
Quality
Search
Feedback

Java Pluglet API
by Akhil Arora <akhil.arora@sun.com>
and Igor Kushnirskiy <idk@eng.sun.com>

A Pluglet is a Plug-in that is written in Java. A Pluglet is similar in concept to a Servlet, with the difference that a Servlet produces content, whereas a Pluglet consumes it. The Java Pluglet API is a close 1:1 implementation of the new C++ Plug-in API in Mozilla.

  • Why Pluglets?

  • Pluglets are part of the Blackwood project. For a Plug-in developer, choosing to extend Mozilla via a Java Pluglet brings the advantages of the Java Platform to Pluglets.

    • Platform neutral

    • Writing a Plug-in in Java instantly makes it available on all platforms on which a Java Virtual Machine supporting OJI is available.

    • Compact

    • For a given functionality, Java bytecode is typically smaller than compiled native code, so the time needed to download a Plug-in is reduced.

  • Pluglets vs Applets

  • A frequently asked question is how are Pluglets different from Applets. There has been a discussion of this on MozillaZine. Basically there are two differences. A Pluglet is launched when a certain Content Type is encountered, whereas an Applet is launched when an <applet> tag is encountered. The other difference is that Pluglets are installed onto disk and unlike Applets, are not downloaded at each invocation.

  • How?

  • Key to enabling Pluglets is the Pluglet Runner. The Pluglet Runner appears to Mozilla like a regular C++ Plug-in. When asked by the browser for the MIME types it handles, it coalesces the MIME type handled by all the Pluglets that it finds and returns the sum total as the MIME types it can handle. Later, when the browser encounters a MIME type the Pluglet Runner registered for, it simply delegates to the appropriate Pluglet. Some JNI is involved to go from C++ to Java and back again.

  • Defining the Pluglet API

  • The Java Pluglet API is not cast in stone, we just took the C++ API and did a straight port to Java to arrive at a starting point for discussions on the API. Please feel free to post suggestions to the netscape.public.mozilla.java newsgroup.

  • Design Goals

  • It was a conscious design decision to have the Pluglet API resemble as much as possible its C++ counterpart, while being able to reflect all of its functionality to Java, so that Plug-in writers will not have to learn yet another API. This concern, in our opinion, outweighed other alternatives which offered a cleaner, more Java-like look. Support for other Plug-in APIs can be easily added by contributing adaptors.


Copyright © 1998-1999 The Mozilla Organization.