Alex, Thanks for leveraging the Restlet API in this new effort. This looks useful and really promising!
I've just updated the Restlet Web site to mention third-party integrations (eXist and XMPP for now). Let me know if important info is missing: http://www.restlet.org/documentation/1.0/integrations Best regards, Jerome > -----Message d'origine----- > De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la > part de Alex Milowski > Envoyé : vendredi 20 avril 2007 08:31 > À : [email protected] > Objet : Restlet & XMPP > > I've been working on an integration of the Restlet Client and > Server APIs > with XMPP. I now have a working version (with many caveats). > > You can now do post, put, get, or head via XMPP with uris > structured as: > > > xmpp://{sender}/{sender-resource}/{recipient}/{recipient-resou > rce}/{path} > > I struggled with how to structure this URI but I think this makes > sense in that an XMPP client is connected to the server associated > with their sender id (e.g. gmail.com for google talk). To get to > the recipient, you need to talk to your XMPP server, via your > resource name. The message is then sent to the recipient's > specific resource. Keep in mind in XMPP that resources are just > you logged into your IM client on different machines. > > The server is associated with a specific identity that you > pre-establish > when you start your application. In theory, you can have multiple > XMPP+resource pairs running in one process but I haven't tested > that. > > Internally, I'm using the smack API for XMPP. > > So, sending a message over XMPP is now: > > Response response = client.post( > "xmpp://[EMAIL PROTECTED]/chat/[EMAIL PROTECTED]/chat/echo", > new StringRepresentation("Hello World!"],MediaType.TEXT_PLAIN)); > > and setting up a server is a little more complicated. For > example, inside a > component: > > XMPP.Identity id = > XMPP.getInstance().addIdentity("[EMAIL PROTECTED]","password"); > Protocol xmpp = Protocol.valueOf("xmpp"); > getServers().add(xmpp, id.getId(),0); > getClients().add(xmpp); > > and now you can attach a restlet that you can talk to over xmpp: > > VirtualHost host = new VirtualHost(getContext()); > host.attach("/echo",new Restlet() { > public void handle(Request request,Response response) { ... } > }); > > > So far I haven't figured out whether I need to do something > special with > the VirtualHost instance. The "server name", address, etc, > are rather funny > for XMPP since the connection is actually outward and the host doesn't > actually bind to an address. > > I've put in some support for sending "binary types" but I haven't > finished the receiving > part. Right now you can send text/* media types and anything that is > XML (types ending > in "+xml" or any of the XML media types). > > You can take a peek at the code at the new xeerkat project: > > http://code.google.com/p/xeerkat/ > > The old project is at java.net: > > https://xeerkat.dev.java.net/ > > My plans are to move the whole API over to the restlet API and > hide all the agent brokering in local services. > > --Alex Milowski

