ItsNat


ItsNat Natural AJAX, is an open-source Java component-based Ajax framework.

Overview

ItsNat simulates a virtual browser within a Java application running on the server. This virtual browser represents documents using the W3C's DOM Level 2 node tree, and documents can be changed at any time by external Java code running on the server. By means of AJAX, the real user's browser is kept in sync with the server's virtual browser, and can pass W3C DOM events to it. This can for example be used for automatic testing of the real browser under the control of the server.
As of version 1.3 ItsNat provides a new stateless mode.
ItsNat focuses on server centric SEO compatible Single-page applications and web sites.

How it works

;Stateful mode
When the server DOM tree is modified using Java W3C DOM APIs by the developer, this modification is detected and automatically sent to the real web browser as JavaScript DOM based code, synchronizing the client DOM accordingly, usually as response of an AJAX event.
The developer code in the server can register Java W3C DOM Event listeners listening for W3C DOM events, this listener registration is automatically propagated to the client. When the user, for instance, clicks a "listened" element, the real browser event is sent to the server using AJAX, converted to a W3C DOM event and received by the server based listener.
The original page layout is defined using pure HTML, XHTML, SVG, or XUL based templates with no logic. If the modification is big ItsNat provides "template fragments", a template fragment is a piece of markup that can be inserted as DOM into the main tree statically or dynamically.
To save server memory ItsNat provides a DOM tree node cache in a serialized form and DOM subtrees no longer used can be removed manually only in server saving memory.
Despite same client-server DOM contract, ItsNat provides some tolerance to DOM nodes introduced by non-ItsNat JavaScript code, static zones in server can be managed by non-ItsNat JavaScript code, DOM subtrees removed only in server can be changed freely in client, and in some locations, "intrusive" nodes are tolerated.
;Stateless mode
In stateless mode, introduced in version 1.3, the client page sends the necessary custom data of the current state to the server usually through AJAX requests, the server with this data is able to reconstruct partially or fully the client DOM state going to be modified and generate the necessary JavaScript DOM code, returned to the client to bring it to a new state, usually modifying the client page DOM tree according to the action which motivated the request. This mode may be not so fine grane and performant than the stateful mode, however this approach is more easily scalable because there is no per client page data kept in server and therefore AJAX requests can be dispatched to different server nodes with no need of session data sharing or server affinity need in stateful mode.

Core features

ItsNat provides an optional Component system built using the core features of the framework. These components are AJAX based and inspired in Swing, reusing Swing as far as possible such as data and selection models, but ItsNat is not a Swing clone in the web and is not a pixel based web framework.
ItsNat provides several button types, text based components, labels, lists, tables, trees usually with content editable "in place".
Any HTML element can be a component, for instance any element can be a normal button, a check box, a radio button, any element list may be a combo or a list component, for instance a group of SVG circles may be a multiple selection list component. Components can be used to generate XML too.
ItsNat components are not intrusive because the component view is provided by the developer and attached to the component.

Requisites, platforms

ItsNat is pure Java and runs in any Java Virtual Machine v1.5 as the minimum configuration and virtually any servlet-compliant container.
Google App Engine is supported, including AJAX with some limitations.
;Supported desktop browsers:
Google Chrome, Firefox, Internet Explorer 6+, Opera 12.12+, and Safari 5.1.7+.
;Mobile browsers :
SVG plugins : Adobe SVG Viewer v3 , Savarese Ssrc , SVGWeb , and Batik as applet.