Monday, June 4, 2007

Why need Tomcat to run js2gtalk?

Here's a reply from one of the author of J2S, in their google groups:
Zhou Renjian
From: "Zhou Renjian"
Date: Sat, 2 Jun 2007 11:16:21 +0800
Local: Sat, Jun 2 2007 11:16 am

Subject: Re: J2S Gtalk demo : Why do we need to deploy it on Servlet Container (ie. Tomcat)

Here is how the current Java2Script GTalk works: Java2Script GTalk
(browser side) packs some message into HTTP request, send to Apache
server. And Apache server redirects requests to Tomcat server (Java
Servlet container). Then Java Servlet setups and keeps a XMPP
connection to Google Talk Jabber server using Smack library, and then
sends out request, and responses Jabber server's response, which will
redirected to Apache server. And Apache server then returns responses
through HTTP connection to browser. Java2Script GTalk finally updates
its messages or status.

The reason why there is a Tomcat server is that Apache server is not
designed to execute Java codes while Tomcat is. And in fact, you can
build up Java2Script GTalk without Apache server. Tomcat is already
an HTTP server. And the connection will be simplified to:
Java2Script GTalk <--HTTP--> Tomcat <--XMPP (Jabber) [Smack] --> GTalk Server

BTW: you can run Java2Script GTalk standalone as SWT desktop
application with a Java VM environment.


See the communication path :D

No comments: