Servlets

On the server side, we're not ready to accept an XML-RPC or SOAP request yet because that would require parsing an input XML document. I'll take that up beginning in Chapter 5. On the other hand, we are completely ready to respond to a CGI request with an XML document. Because this is a book about Java, I'll use servlets to do this. The user will connect to a known URL. The query string component will include a field asking for a certain number of Fibonacci numbers. The servlet will calculate that number and return it as an XML document with an attached stylesheet.

The query string will include a single generations field whose value is the index of the last Fibonacci number you want. For example, for a servlet installed at http://www.elharo.com/fibonacci ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.