Architectural Overview
The core of Jaxer is written in C/C++ and is powered by the same Mozilla engine that powers Firefox 3. There is a wrapper Javascript framework which can be easily extended by developers if needed.
Jaxer provides a plugin as post-processor to the web server and receives an static HTML as input. The core framework is responsible for parsing the input, executing scripts (server-side) and generating proxies.
The framework allows the developer to mark Javascript functions to be executed in the server using – runat=”server” attribute in the script tag. There is also runat=”server-proxy” where when the client calls are redirected to be executed in the server, the framework is responsible for injecting the methods.
From the server-side code there is also access to the Jaxer library and hence access to session, file system, database, network sockets, etc.
Thanks to Aptana for the image.
Mobile in Minutes
Here I would like to outline an use-case which will enable web properties to quickly create a mobile flavored output using Jaxer. This is intended to be a proof-of-concept and an example for the possibilities enabled by this framework. Lets say you have an existing simple web application and want to enable mobile flavored version modifying the existing application. This solution levereges the server-side processing of Jaxer to identify elements of interest from the HTML and renders a modified output.
Here the idea is to annotate on the HTML elements of the original output. It could be id=”mobile-????”. This step is just to identify elements of interest and construct a modified html. Here is a brief code snippet which should provide some direction and simply by injecting this script and marking ids mobile should do the job. This is no way intended to be a full-fledged implementation but to give a direction and server as a proof-of-concept:
var m = document.createElement(“body”);
var e = document.getElementsByTagName(“a”);
m.innerHTML = ‘Mobile rendering: ‘;
for ( var i = 0 ; i < style=”font-style: italic;”>
{
var l = e[i];
if (l.id == ‘mobile’) {
m.innerHTML = m.innerHTML + ‘ ‘ + l + ‘ +”;
}
}
k.innerHTML = m.innerHTML;
Technorati Tags: technology, javascript