O'Reilly logo

JavaBeans Unleashed by Rick Leinecker, Dr. Donald Doherty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required