ItsNat
Initial release | November 1, 2007 |
---|---|
Stable release |
1.4
/ September 18, 2015 |
Written in | Java |
Operating system | Cross-platform: JVM |
Type | Ajax framework |
License | Dual license: LGPL, Proprietary [1] |
Website |
www |
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.[2] This can for example be used for automatic testing of the real browser under the control of the server.[3]
As of version 1.3 [4] 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 (firing DOM mutation events) 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 (ItsNat is heavily based on AJAX).
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(s).
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 (included) as DOM into the main tree statically or dynamically (typically as a response of a user/Ajax event).
To save server memory ItsNat provides a DOM tree node cache in a serialized form (as plain text not DOM) and DOM subtrees no longer used can be removed manually only in server saving memory (the client DOM remains untouched).
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 (between and at the end of head and body elements), "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 (NIO or similar) 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 (v3.0) 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 (like FireFox) 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 (custom version for ItsNat) in an APPLET/OBJECT/EMBED.
- Java to JavaScript generation utilities.
- Server-sent events (events fired by the server sent to the client simulating user actions) 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 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 (markup) 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+ (including v9), Opera 12.12+, and Safari 5.1.7+.
- Mobile browsers (all including AJAX)
- WebKit-based:
- Android 2.1+
- iPhone/iPad/iPod Touch iOS 6.1+
- S60WebKit (since S60 5th v1)
- S40WebKit (since S40 6th)
- Opera:
- Opera Mini 4.x+
- Opera Mobile 12.10+
- BlackBerry JDE 4.6+ (Bold, Storm an upper)
SVG plugins (including AJAX): Adobe SVG Viewer v3 , Savarese Ssrc (adds XUL to MSIE too), SVGWeb , and Batik as applet.
See also
References
External links
- Official website
- Online demo and examples with source code
- Online demo in Google App Engine
- Introducing ItsNat (CometDaily)