uri: http://dev.day.com/microsling/content/blogs/main/microjax.html
posted 12 December 2007 by David Nuescheler
filed under sling microsling tutorial crx microjax
µjax (microjax or ujax) is a client sided javascript persistence layer that leverages the symbiosis of a (JCR compliant) Content Repository and the agile patterns of browser based ajax development, to form a completely new way of developing applications.
microjax is a part of Apache Sling which is currently in incubation.
As an important differentiator to other Ajax frameworks µjax focuses on adding an attractive server-sided persistence and does not focus on providing a rich application framework with components, widgets or visual effects. µjax can be combined with any Ajax framework of your choosing.
µjax uses XHR & JSON based AJAX techniques to retrieve content and uses regular form input to write content.
Knowledge of Javascript and HTML are required.
An understanding of JCR is certainly very helpful to quickly start developing in µjax.
The µjax pre-release can be downloaded attached (below) to this post pre-packed with the attached CRX builds. (Windows, Unix, Linux & macosx)
Keep in mind:
Nightly builds are intended to provide CRX Developers with the latest enhancements and bug fixes. A NIGHTLY BUILD IS NOT AN OFFICIAL RELEASE AND IT IS NOT TESTED BY QA. USE IT AT YOUR OWN RISK. IT IS RECOMMENDED NOT TO USE A NIGHTLY BUILD ON A PRODUCTION SYSTEM, BUT TO USE IT FOR DEVELOPMENT PURPOSES ONLY. DAY MANAGEMENT AG CANNOT BE HELD RESPONSIBLE FOR ANY DAMAGE THAT COULD BE CAUSED BY A NIGHTLY BUILD.
To be able to install CRX you will have to get an evaluation license, which can be obtained by filling out the following form.
µjax is only installed in the default installation of CRX, so please select that option in your downloaded CRX installer.
The installation is very straight forward and does not have dependencies beyond a JDK 1.4 or greater.
To be able to interact with the content repository for development purposes
it is recommended to use webdav and connect to
http://localhost:7402/crx/repository/crx.default
On Windows use "My Network Places" / "Add new network place"
On macosx use "Go" / "Connect to Server" in Finder
Explore you content repository at http://localhost:7402/crx, as soon as you start developing your applications you will find both your code and also the content your applications create in the "Content Explorer".
To get started please either use the test application below or just extract the "firststeps.zip" (below) and drag and drop the "apps" folder into root folder of your webdav mount.
Put the source code below into a test.html file and drag this into your mounted webdav drive:
<html><head><title>Hello World</title> <script src="/ujax/ujax.js"></script> </head> <body> <script> var welcomeNode=ujax.getContent("/content/welcome"); </script> <h1>Welcome String: <script>if(welcomeNode)
{ document.write(welcomeNode.hello); }
</script></h1> <form action="/content/welcome" method="POST"> <input name="hello" value="" /> <input type="submit"> </form> <script>ujax.wizard();</script> </body> </html>
and hit http://localhost:7402/test.html
in your browser.
To get a feeling of a more real-life application feel free to download an µjax-ed version of Stefano's Linotype you can simply extract the "linotype.zip" (attached below) into the /apps folder of your webdav drive pointing at http://localhost:7402/
After the installation hit http://localhost:7402/content/linotype/posts/*.post.html and hit the save button to create your first blogentry. After creating the post you can surf to http://localhost:7402/content/linotype.html
Please keep in mind that this is really just prototype to explain the µjax basic concepts and how they could be applied to existing web applications without a lot of effort.