This section provides an introduction to the various technologies and designs on which Vaadin is based: AJAX-based web applications in general, Google Web Toolkit, and JSON data interchange format. This knowledge is not necessary for using Vaadin, but provides some background if you need to make low-level extensions to Vaadin.
AJAX (Asynchronous JavaScript and XML) is a technique for developing web applications with responsive user interaction, similar to traditional desktop applications. While conventional JavaScript-enabled HTML pages can receive new content only with page updates, AJAX-enabled pages send user interaction to the server using an asynchronous request and receive updated content in the response. This way, only small parts of the page data can be loaded. This goal is archieved by the use of a certain set of technologies: XHTML, CSS, DOM, JavaScript, XMLHttpRequest, and XML.
AJAX, with all the fuss and pomp it receives, is essentially made possible
by a simple API, namely the XMLHttpRequest
class
in JavaScript. The API is available in all major browsers and, as of 2006,
the API is under way to become a W3C standard.
Communications between the browser and the server usually require some sort of serialization (or marshalling) of data objects. AJAX suggests the use of XML for data representation in communications between the browser and the server. While Vaadin Release 4 used XML for data interchange, Release 5 uses the more efficient JSON. For more information about JSON and its use in Vaadin, see Section 3.2.3, “JSON”.
If you're a newcomer to Ajax, Section 12.1, “Special Characteristics of AJAX Applications” discusses the history and motivations for AJAX-based web applications, as well as some special characteristics that differ from both traditional web applications and desktop applications.
Google Web Toolkit is a software development kit for developing client-side web applications easily, without having to use JavaScript or other browser technologies directly. Applications using GWT are developed with Java and compiled into JavaScript with the GWT Compiler.
GWT is essentially a client-side technology, normally used to develop user interface logic in the web browser. GWT applications still need to communicate with a server using RPC calls and by serializing any data. Vaadin effectively hides all client-server communications, allows handling user interaction logic in a server application, and allows software development in a single server-side application. This makes the architecture of an AJAX-based web application much simpler.
Vaadin uses GWT to render user interfaces in the web browser and handle the low-level tasks of user interaction in the browser. Use of GWT is largely invisible in Vaadin for applications that do not need any custom GWT components.
See Section 3.4, “Client-Side Engine” for a description of how GWT is used in the Client-Side Engine of Vaadin. Chapter 11, Developing New Components provides information about the integration of GWT-based user interface components with Vaadin.
JSON is a lightweight data-interchange format that is easy and fast to generate and parse. JSON messages are said to be possibly a hundred times faster to parse than XML with current browser technology. The format is a subset of the JavaScript language, which makes it possible to evaluate JSON messages directly as JavaScript expressions. This makes JSON very easy to use in JavaScript applications and therefore also for AJAX applications.
The Client-Side Engine of Vaadin uses JSON through Google Web
Toolkit, which supports JSON communications in the
com.google.gwt.json.client
package. Together with
advanced update optimization and caching, Vaadin is able to
update changes in the user interface to the browser in an extremely
efficient way.
The use of JSON is completely invisible to a developer using Vaadin. Implementation of client-server serialization in custom widgets uses abstract interfaces that may be implemented as any low-level interchange format, such as XML or JSON. Details on JSON communications are given in Section A.2, “JSON Rendering”.