|
Clientlets in Lobo
Clientlets are classes that implement the interface Clientlet
as defined in the Clientlet and Extensions API of the Lobo browser.
Clientlets handle web responses and generally render content by producing
a Swing or AWT component. They may be thought of as the counterpart of
servlets in the client.
Control Flow
A clientlet receives control when its process method is called.
An instance of ClientletContext is passed to the method. A
clientlet context contains information about the web request and response,
as well as various utility methods.
A clientlet must process the web response and do one of the following:
- Set a GUI content object by calling setResultingContent.
- Redirect to another document by calling navigate or another such method.
- Cancel the request by throwing CancelClientletException. This
is what is done by the clientlet that triggers downloads in Lobo.
Setup
Currently only extensions (plugins) can set up clientlets in Lobo, by calling
addClientletSelector
when the extension's
init()
method is invoked by the browser. A clientlet selector is in charge of creating
a Clientlet instance after checking whether a web response is of
a type that can be handled by the clientlet in question. This is typically done
by invoking the
matches()
method of the response object.
Sample Code
Lobo implements several clientlets in its primary extension. The following
is a simple clientlet that is used by Lobo to render text files.
TextClientlet.java
See Also
External Links
Support The Project
|