jMaki Comet demo in GlassFish

(Based on http://weblogs.java.net/blog/jfarcand/archive/2007/03/jmaki_comet_orb_1.html)

Messaging

  • GlassFish comes with the latest version of Grizzly
  • Grizzly now has support for Comet (long-lasting HTTP connections for server2client async interaction)
  • Comet Programming Model is simple with GlassFish and sexy with jMaki.

Setup

  • Add this property to the port 8080 <http-listener> in the appropriate domain.xml file :
<property name="cometSupport" value="true"/>
  • Restart if needed
  • Get application WAR file (called jmaki-comet.war)
  • Simply deploy application using Web UI, command-line or simply dropping the .war file in the domain autodeploy directory.

Demo Steps

You need to use 2 different kind of browsers. I usually use Netscape/FireFox on windows or Safari/Firefox on Mac. This is the limitation of the Ajax queue in the browser especially if you run both clients and server on the same machine.

  • Add new words, watch flickr provide images (via jMaki), move images and see them move in others browser(s).
  • Bonus points: use FireBug to show requests and NetBeans (5.5 or 5.5.1) to show and debug code (source is here)

CleanUp

  • Eventually undeploy and redeploy.
  • Application is stateless, so nothing to do really.

See Also