ItsNat is a new Java web framework with Comet capabilities. In this article we’re going to see how ItsNat fits in the ecosystem of Comet technologies, and how ItsNat works and provides support for Comet.
I’m the author of ItsNat, a Java web framework with Comet capabilities. In the beginning of ItsNat development I knew of Comet, but it wasn’t in my list of ideas for ItsNat until I realized that Comet was a perfect fit. Today, the most interesting ItsNat features like remote page monitoring, server-sent events and functional testing are based on Comet.
In response to my initial question, “What can I contribute to Comet Daily?”, I realized that I can be the “Java Web Framework guy” of Comet Daily. This auto-assigned “position” is interesting for Comet Daily because adds a new piece to the Comet puzzle:
- Jetty & Grizzly: both provide servlet implementations with scalable asynchronous requests that are very useful for Comet. Among other things, they provide low level infrastructure for Comet in the Java server side.
- DWR: a browser-servlet bridge using Ajax. DWR can perhaps be thought of as a “low level” Java web framework for Ajax and Comet (in addition to its remoting capabilities).
Where does ItsNat fit in this scenario?
ItsNat is a new technology. A Google search for Java web framework Comet surprisingly shows an article about ItsNat on the first page of results.
With the exception of DWR and IceFaces, Java web frameworks generally do not provide integrated support for Comet. I think this is going to change because Comet in my humble opinion is going to be one of the most influential technologies in the future, changing how we build and use the web. Of course, Flex, Silverlight even JavaFX will have a role and will use Comet, but if the Open Web continues to flourish, Comet, using pure web technologies, will have a very important role in “Web 3.0″. If “Web 2.0″ = web + Ajax (from a technical perspective), will be “Web 3.0″ = web with Ajax + Comet = real time web?
ItsNat and DWR comparison
ItsNat is a server centric Java web framework with out of the box” Comet capabilities. It might be perceived as being in the same space as DWR, but there are several key differences with ItsNat:
There is actually not much overlap between DWR and ItsNat, because DWR is focused on browser centric development and ItsNat on server centric development.
How ItsNat works
ItsNat approach to web development is called TBITS, “The Browser Is The Server”, because ItsNat simulates a Java W3C browser in the server:
- Keeps a DOM tree in the server of the page seen by the user. The browser DOM is a clone of the server DOM. Most of the work of the framework is to synchronize both trees.
- Any server DOM tree element can receive client events that are transported to the server using Ajax. These browser events are received as Java W3C DOM Events and dispatched to the Java W3C DOM EventListeners registered in the server. A client event is transported to the server only if a server listener matching the target node is registered.
ItsNat provides some typical components like buttons, labels, lists, tables or trees. Built on top of the basic infrastructure described previously, the use of these components is optional and with little hassle, any developer can build their own custom components using Java W3C DOM and DOM Events APIs.
ItsNat is focused on Ajax, and doesn’t provide much for classic page based navigation. I’m a firm believer in the “One Single Web Page” (OSWP) paradigm, especially for web applications. To help with the OSWP approach, ItsNat provides page fragments, a pure X/HTML or SVG page where only the markup contained in the body element is used. The page fragment is loaded as DOM and used as the pattern to replace some or all of the main page with no page navigation. In this OSWP scenario, Comet may have a very important role.
A very brief overview of Comet in ItsNat
In the next article, I’ll go into more detail on how to use Comet in ItsNat.