ActiveBean Example

To illustrate how easy it is to make JavaBeans comply with JAF, I wrote the ActiveBean based on JavaSoft's NervousText applet. In terms of JAF, ActiveBean defines the Nervous command for the MIME type text/*.

ActiveBean implements the javax.activation.CommandObject interface, whose only method is

public void setCommandContext(String verb, DataHandler dataHandler)

The setCommandText() method is called by JAF when the bean is activated. In the method body of setCommandContext() we obtain an input stream of the data item's data from the DataHandler. Then we read the first line of text from the input stream and store it in a member variable. This is all we need to do to make our ActiveBean JAF compliant. The rest of the program ...

Get JavaBeans Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.