[ Pobierz całość w formacie PDF ]
Besides data access, OpenLaszlo offers various approaches to integrating server-side processes with the client
application flow. One way of establishing a connection to a server in the background is the XMLHttpRequest
class, which OpenLaszlo provides in the form of script blocks and Javascript implementations for current
browsers.
In contrast to Javascript code, which runs in the browser, the similar OpenLaszlo code does not pose any
issues with browser incompatibility. OpenLaszlo converts the Javascript code to Flash bytecode that the
Flashplayer, rather than the browser's Javascript engine, runs.
Besides XMLHttpRequest in Javascript code, OpenLaszlo also supports the SOAP protocol. Listing 6 provides
some sample code that establishes a connection to the Amazon SOAP interface and outputs the available
methods in a debug window.
Listing 6: SOAP
01
02
03 height="500" />
04
05 wsdl="http://soap.amazon.com/
06 schemas3/AmazonWebServices.wsdl">
07
08 Debug.write('Amazon soap
09 service loaded');
10 Debug.write('Amazon WSDL at ' +
11 this.wsdl);
12 Debug.write('proxy:');
In a Flash 4
13 Debug.inspect(this.proxy);
14
15
16
SOAP has been criticized for transmitting large volumes of XML code for the simplest of calls. As an
alternative to SOAP, OpenLaszlo also supports the simpler XML RPC protocol.
OpenLaszlo is based on Tomcat 5. The OpenLaszlo SDK contains a Tomcat servlet container. The
precondition for a full-fledged OpenLaszlo server is a Java Runtime Environment, Version 1.4 or newer. The
Java platform brings the ability to access Java objects and methods directly from the client application. An
OpenLaszlo server is easy to set up. After installing the Java SDK, unpack the OpenLaszlo tarball and call
Path/to/unpack/directory/server/tomcat-5.0.24/bin/startup.sh. The sample applications in the archive should
then be accessible on http://localhost:8080/lps-Openlaszlo-Version. On production servers, a rewrite rule in
the Apache configuration ensures that the Apache web server serves up the OpenLaszlo directory as a proxy
on the standard port 80:
RewriteEngine on
RewriteRule ^/directory(.*)$http://localhost:8080/lps-Openlaszlo-Version$1 [p]
For more information on server administration, see the OpenLaszlo site [4]. In environments without a Java
Runtime Environment, such as shared web hosting without root access, OpenLaszlo can be run in solo mode.
An OpenLaszlo server can compile the applications as separate, executable .swx files that provide the whole
functionality in Flash code that runs client-side. A web server without Java can provide this support on the
Internet; however, RPC functions are not available in these applications.
Conclusions
The OpenLaszlo XML language relies on standards that web developers will be familiar with in many areas.
The XML tags for defining display elements are similar to HTML tags. The client-side program logic uses
typical DOM syntax to access tags. Javascript 1.4 is used as the programming language. The display elements
are visually more attractive than their HTML counterparts and can be animated without too much effort.
Besides the typical web programming approach of generating client-side program code in the server's own
language, OpenLaszlo has more powerful methods of client-server interaction. In addition to
XMLHttpRequest, the framework supports SOAP and XML RPC, as well as the option of calling server-side
Java program code directly in the client. OpenLaszlo applications run on the proprietary Flashplayer, which
might seem to be a disadvantage to some users but guarantees robustness and cross-browser compatibility that
removes the need for extensive testing. The next version of OpenLaszlo will be capable of using Ajax for the
client-side display and program logic.
INFO
[1] Flashplayer use according to the vendor:
http://www.adobe.com/products/player_census/flashplayer/version_penetration.html
[2] Overview of form elements in OpenLaszlo:
http://www.openlaszlo.org/lps/examples/components/style_example.lzx
[3] Xpath: http://en.wikipedia.org/wiki/XPath
[4] OpenLaszlo server administration: http://www.openlaszlo.org/lps/docs/deploy/deployers-guide.html
In a Flash 5
[ Pobierz całość w formacie PDF ]