|
AjaxSwing is AJAX version of WebCream, a product that has been developed and maintained since 1999. This document describes the most significant changes
and tasks required for migrating existing code.
Architecture Changes
The main difference between
AjaxSwing and WebCream is that AjaxSwing moves away from full page submissions
and uses XMLHttpRequest to send the data and action to the server. This request is asynchronous and it doesn't block
the browser. Just like before, the data is setto the components and the action is emulated. However, instead
of sending the full HTML page back to the browser, AjaxSwing determines which components have changed
since the previous request. The change can be insert, delete or update, and
it is based on the previous component hashes that are stored between the request.
Once the change set has been determined, it is returned to the
client. The client-side JavaScript iterates the list of changes and applies them to the page. This greatly improves the
performance and user experience.
Package and Class Renaming
The most obvious change is that creamtec.webcream package has been renamed to com.creamtec.ajaxswing and every
name or string that had "webcream" in it was changed to "ajaxswing" (honoring the
case). Thus a client reference old classes such as creamtec.webcream.WebCreamManager should be replaced with com.creamtec.ajaxswing.AjaxSwingManager.
Custom Renderers
Custom renderers have to be
reviewed to make sure that they are AJAX compliant. WebCream didn't place
restrictions on the HTML produced by the renderer. It also didn't restrict the
timing of using HTMLPage APIs such as appendScript() and includeStylesheet().
This is because the full page was rendered every time. In AjaxSwing the full
page is only rendered initially (and in certain conditions such as when a user
hits Refresh button). After the initial rendering, only changes are sent to the
browser. AjaxSwing requires that a renderer produces a
self-contained single HTML element with component ID that may
include HTML and JavaScript child elements. For more details, see Custom Components.
|