Tic Tac Toe using Rails and Grails on GlassFish v3
By arungupta on Jun 01, 2008
GlassFish v3 is a modular (OSGi compliant), embeddable (runs in-VM) and extensible (hosts non-Java applications) Application Server. The "extensible" part was demonstrated during JavaOne 2008 by deploying Rails, Grails and Django sample application on GlassFish v3 Technology Preview 2. This blog announces the availability of Rails, Grails and (of course!) Java EE version of the demo code.
The sample application is a simple multi-player game that can be played on Internet and deployed on GlassFish. One of the simplest multi-player game is Tic-Tac-Toe. The complete instructions to checkout, build, deploy and run the sample are available here. The demo can certainly be improved by using the best practices from Rails and Grails and I'll work on them in next few days.
The demo is played in 2 different browser windows (tested on Firefox, Safari & IE). The clicks in the grid on one browser are displayed on the other browser (propagated using GlassFish Comet) and row and column winners are shown.
Some points highlighted by the demo are:
- GlassFish v3 supports deployment of Rails and Grails applications, in addition to traditional Java EE apps.
- GlassFish v3 has a completely modular architecture as evident by the pluggability of JRuby/Rails.
- Features of the underlying GlassFish runtime can be accessed.
- Any click in the grid is pushed to the endpoint and then propagated to all the clients using GlassFish Comet. So effectively, now you can build Comet-enabled applications using Rails and Grails.
- Rails application is deployed as a composite application where Serlvet is bundled with the application and accessed from the View.
You can learn about the support of different Dynamic Languages on GlassFish on glassfish-scripting.dev.java.net. Send us feedback on firstname.lastname@example.org or GlassFish WebTier Forum.
Technorati: conf javaone javaone08 jruby ruby rubyonrails grails javee glassfish v3 netbeans