The com.thinlink.xp package implements XP draft 00 using stream sockets and the Apache Crimson processor. You use an event-listener interface and the Document Object Model to build, send and receive XML documents.
Author: Tom Harding
tomh@thinlink.com
Download com.thinlink.xp Version 0.2.0 [416K]com.thinlink.xp is distributed under the GNU General Public License.
Browse Documentation
XP is extremely simple and lets you build outward from the wire, rather than inward from a complex software interface. XP's only dictate is that everything that crosses the wire is XML. There is no distinction of the representation of control information from that of data. If you need to define an authentication procedure, use XML documents. If you want to add error reporting, use XML documents. If you want to use your existing document types as valid messages in your protocol, go right ahead.
XP might be used for generic frameworks, homegrown special-purpose protocols, or anything in between -- about the same range as XML itself.
To run the sample, you might type:cd xp_0_2_0
javaw -classpath .;xp.jar;crimson.jar HelloEndpoint.HelloEndpoint
You will need to import these packages:
import java.net.*;Create an Endpoint. For example:
import org.w3c.dom.*;
import com.thinlink.xp.*;Endpoint endpoint = new Endpoint();The other side needs to be waiting to accept a connection, and also must be prepared to speak XP. Start the Endpoint's XP processing like this:
endpoint.setSocket(new Socket("xp.acme.com", 1222));endpoint.start();To send a request (i.e. act like a client), you could do this...endpoint.sendRequest(myDocument, null);To register DocumentListeners to process unsolicited requests (i.e. act like a server), call(To process responses, you would need to pass a DocumentListener. See docs.)
endpoint.addDocumentListener