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 modeWhen 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
- Automatic client synchronization from server.
- Some support of automatic server synchronization from client.
- Web-continuations: "continue" events.
- User defined event types.
- AJAX timers.
- Long running asynchronous server tasks: client is notified when finished.
- Comet without special Servlet engines.
- Server side DOM utils: to simplify DOM manipulation like lists, trees, ElementCSSInlineStyle support etc.
- Resolution of $ based variables in markup: helps keep Java DOM code as agnostic as possible of the concrete layout.
- Markup fragments: dynamic parts of the page to be inserted in any time very useful in Single Page Interface.
- SVG, and other namespaces, embedded inline on XHTML and application/xhtml+xml MIME.
- SVG, and other namespaces, embedded inline on X/HTML and text/html MIME on
- * Browsers with native SVG.
- * MSIE with Adobe SVG Viewer plugin including dynamic processing of SVG DOM.
- * Any browser with Flash support using SVGWeb.
- Pure SVG documents including AJAX in browsers with native SVG or MSIE with Adobe SVG Viewer or Savarese Ssrc plugin.
- Pure XUL documents including AJAX in Gecko browsers or MSIE with Savarese Ssrc plugin.
- XML generation.
- IFrame/Object/Embed/Applet Auto-Binding: in server child documents opened by IFRAME, OBJECT, EMBED or APPLET tags are automatically bound to the parent document in server. This feature works with:
- * X/HTML loaded by an IFRAME.
- * SVG loaded by an IFRAME/OBJECT/EMBED in browsers with native SVG or MSIE with Adobe SVG Viewer or Savarese Ssrc: only OBJECT and EMBED.
- * SVG loaded by Batik applet in an APPLET/OBJECT/EMBED.
- Java to JavaScript generation utilities.
- Server-sent events with the real browser or simulated for instance to test the client view simulating user actions or simulating the client in server.
- Referrers: in page navigation, the prior document in server can be obtained to copy any data avoiding session data in page based applications: navigation includes back/forward/reload support; two modes: push and pull.
- Degraded modes: AJAX disabled and JavaScript disabled modes.
- Extreme Mashups.
- AJAX bookmarking: or bookmarking in Single Page Interface applications.
- Pretty URLs.
- Automatic page remote/view control of other users/sessions.
- Remote Templates.
Component system
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 :
- WebKit-based:
- *Android 2.1+
- *iPhone/iPad/iPod Touch iOS 6.1+
- *S60WebKit
- *S40WebKit
- Opera:
- *Opera Mini 4.x+
- *Opera Mobile 12.10+
- BlackBerry JDE 4.6+