views:

861

answers:

3

gwt Comet easier to implement on jetty or tomcat?

A: 

I really doubt it makes any difference at all.

stevedbrown
I saw the jetty has the connections library, which seems to make it easy to handle multiple connections on a single thread... does Tomcat have similar capabilities?
jcee14
Yes, but with a different API. Jetty's method is more intuitive (request a Continuation and use that to "pause and resume" Servlet request). In Tomcat, your Servlet implements CometProcessor which defines event( CometEvent ) which is invoked at the start and end of the connection, when the client sends data and when an error occurs. Use ServletResponse.getWriter() for data to the clientJetty uses clever exception throwing magic; Tomcat (I think) maps more 1:1 to the underlying NIO API.http://tomcat.apache.org/tomcat-6.0-doc/aio.htmlhttp://docs.codehaus.org/display/JETTY/Continuations
Alan Donnelly
Agree with @stevedbrown BTW Whichever you use will make little difference :-)
Alan Donnelly
+1  A: 

There is a GWT Comet Adapter which works with a standalone server called Streamhub. I host my Swing MVC app in Tomcat and use StreamHub as a Comet server.

Supertux
A: 

I agree with Supertux's answer - if you use Jetty or Tomcat you will have many more threads or connections in your main server - its better to offload the streaming connections to a server that was built to handle it.

codingfloor