powered by Jive Software

Smack and Tomcat

Has anyone managed to use Smack (as a server, not a client) with Tomcat? I want to handle incoming requests inside of Tomcat. So, the user would send an IM and my program would get the request, dispatch its handling to a servlet, then return a message with the result.

It seems to me that I’'d need to build custom subclasses of org.apache.catalina.{Request, Response, Service, etc} to do this. Has anyone tried this? Does anyone have any advice? Thanks.

Dan,

Yes, we’'ve used Smack inside web applications on Tomcat and other appservers. Are you running into any problems or did you just want confirmation that it is possible?

Regards,

Matt

Well, it seems pretty straightforward to use Smack inside Tomcat as a client. What I’'m wondering if anyone has done is to build a connector so that requests sent via jabber (rather than HTTP) invoke a servlet.

Thanks.

Just to clarify my last message, Smack would still be acting as a “Jabber client”, but it would be like the traditional server side on Tomcat.

So, some random Jabber client sends a message to the JID registered (eg smacktomcat@foo.com/service). It then takes that Jabber message, invokes a servlet that parses that message an generates a response. Then it replies.

Thanks again,

dan

Hey Dan,

You could easily create a chat bot that would call a servlet using an HTTPConnection and read the the inputstream response and send that back. This way, your chatbox would act like a webservice.