Table of Contents
As explained in Chapter 1, OpenLaszlo Architecture, there are two distinct ways in which OpenLaszlo applications can be deployed, that is, made available on the web:
Deploy SOLO (Standalone OpenLaszlo Output) from any HTTP Web server
Deploy with OpenLaszlo Server
With SOLO deployment, the LZX source is pre-compiled into a stand-alone SWF file that can be placed within the HTML docs directory of a common HTTP Web Server (such as Apache or IIS). SOLO deployments are simple to manage, and supported by nearly any Web hosting service, such as, for example Apache.
Colloquially, SOLO deployment is sometimes called "serverless," because the OpenLaszlo Server is not required for operation of the application.
OpenLaszlo Server deployment is also called "proxied" deployment, because the OpenLaszlo server is always running, and it mediates, or proxies, communication between the OpenLaszlo application running on the client machine and any back-end services or resources located elsewhere on the web.
With OpenLaszlo Server ("proxied") deployment, you place the LZX source (.lzx) file within the Web-apps directory of the OpenLaszlo Server. The first time you browse to that file it is dynamically compiled, and it is automatically recompiled whenever the source changes. (You refresh the page to force the recompilation.) OpenLaszlo Server deployment requires a Java Application Server or servlet container. It provides additional capabilities dependent on the server, including support for SOAP, XML-RPC, Java-RPC and persistent connections. The OpenLaszlo Server is also required for applications that use some media formats that are not natively supported by the Flash Player. The OpenLaszlo Server transcodes these media files "on the fly" into formats supported by the Flash Player.
Deploying SOLO is generally more convenient than deploying with OpenLaszlo Server, and often gives better performance.
![]() |
Note |
|---|---|
|
Applications compiled with LPS 2.2 (or earlier) require access to a running copy of the OpenLaszlo Server (called "LPS, for Laszlo Presentation Server, in earlier releases) in order to make data (XML over HTTP), media, SOAP, Java Direct, and XML-RPC requests. OpenLaszlo 3.0 removes this requirement for applications that make only certain kinds of data and media requests. The rest of this chapter pertains to OpenLaszlo 3.0 and later releases. |
|
OpenLaszlo compiles to the SWF Version 6, 7 or 8 (Macromedia Flash) file format. See Chapter 32, Browser Integration for discussion of issues related to differences in target format.
The decision about whether an OpenLaszlo application will be deployed proxied or SOLO can sometimes be made by the system administrator responsible for making the application available on the web. When an application does not make use of any features that require the presence of the OpenLaszlo Server, the same source file can be used to create either proxied or SOLO executable files. In this case the decision between proxied and SOLO deployment can be made at deployment time, and the deployment model is determined by the request type on the URL used to specify the file, as explained below.
Most often, however, it will be you, the developer, who must decide on the deployment method. This is because you will know whether the application relies on the OpenLaszlo Server, and if it does rely on the server (and thus must be deployed proxied) you may want to make some internal optimizations that rely on this fact. In such cases the application may contain proxied="true" in the <canvas > tag, which means that trying to deploy it SOLO will generate an error.
How do you decide whether to target proxied or SOLO deployment? Here is a heuristic:
Do you have the option of installing the OpenLaszlo Server on a deployment server? In particular, is there a Java Application Servere or servlet container available? If not, you must deploy SOLO.
Does your application require services available only in proxied applications? If yes, you must deploy with OpenLaszlo Server.
If your application can be deployed in either manner, which gives the best performance?
Each of these considerations is described briefly below.
The decision about whether to deploy an application proxied or unproxied may happen late in the development process, possibly following performance measurement on the two modes of operation for that particular application.
It is desirable to share libraries between applications that are designed for proxied operation, and applications that are designed for unproxied operation. To the extent that these libraries can operate in either mode, it is desirable to make them usable, without source modifications, in either kind of application.
![]() |
Note |
|---|---|
|
Note that the default behavior is proxied. See below. |
|
As explained in the System Administrator's Guide to Deploying OpenLaszlo Applications, deploying proxied OpenLaszlo applications requires that you install a J2EE application server or servlet container. OpenLaszlo comes with the Tomcat servlet container included, but, depending on how you have access to the web, it may not be practical or even possible for you to use this to make your applications generally available. So, before you decide to start development of an OpenLaszlo application for, say, a hobby website, you should find out whether your ISP provides the capability for you to install a servlet container. If this is not practical for you, you can still develop and deploy SOLO applications.
Access to the OpenLaszlo Server is required for certain run-time features, such as SOAP and XML-RPC requests, and for processing certain types of media files.
Here is a list of features that require OpenLaszlo Server:
media types other than SWF, JPG, or MP3
Persistent Connection
SOAP
XML-RPC
http response headers in XML requests
If your application relies on any of these features, you cannot deploy it SOLO.
In addition, there are differences between how proxied and SOLO applications handle some kinds of XML data and http responses. See below.
If either deployment manner is available to you, the decision may come down to which works better. You should do test deployments under each method and see which gives the faster performance.
The data transfer size and run-time performance may be bigger or smaller, faster or slower. If gzipped data is desired, for SOLO deployment, the XML services will need to gzip the data (since the OpenLaszlo Server will no longer be in the picture). Note that it's not necessary to gzip the swf file, swf6 and swf7 files are internally gzip compressed by the compile process. It would be redundant to have the web server compress them as well.
If an application is compiled for proxied operation, all data and media requests are proxied and the remote procedure calls (RPC) tags are supported.
If the canvas contains the proxied="false" attribute, that means the application will be deployed SOLO. Data and media requests are unproxied, and the compiler performs error detection:
All data and media requests are unproxied.
The presence of the <connection> or RPC tag results in a compiler warning.
The presence of e.g. <view resource="http:logo.png"/>, where the compiler can easily infer that the value of the resource attribute will result in a runtime request for a media type that is not supported in an unproxied media request, results in a compiler warning.
A runtime request for an unsupported service (e.g. myView.setResource('http:logo.png')) will result in a debugger warning, if debugging is enabled.
The <canvas> tag has an optional attribute proxied="true|false|inherit", which defaults to "inherit". If proxied="true|false", the application can only be compiled in that mode. It is an error to provide a request parameter with a different compiler setting, and the developer console UI disables options that generate this request. If proxied="inherit", the application is compiled either for proxied or unproxied operation, depending upon the value of a compilation switch (which defaults to unproxied).
In other words, a canvas file may include only library files that have the same value for their proxied attribute, or the (default) value of "inherit". You can't mix and match, and the presence of the <library> proxied attribute is a way to document to developers and to the compiler that a library can only work in one mode of operation.
In proxied applications, all XML data is parsed as it is passed through the OpenLaszlo server. In SOLO applications, XML data is passed directly to the application, and the data is parsed on the client. Because the parser implementations are slightly different in the OpenLaszlo Server and client, the following differences in data handling exist between proxied and SOLO applications. SOLO applications:
Do not trim whitespace
Do preserve xml namespaces
When loading data, do not provide a way to access http headers.
Also note that the client system not provide any useful error messages when your data has problems in it, whereas the OpenLaszlo Server can provide clues to what's going on. This another reason why it's best to first develop and test your programs as proxied applications, and then make them SOLO.
Whether you're working on proxied or on SOLO applications, you will need to have the OpenLaszlo server installed on your development machine. The server is invoked during the edit-compile-debug cycle, as explained in Chapter 4, Overview of OpenLaszlo Application Development. That means that the server is here to stay as a developer tool.
There are two ways to specify whether an application is compiled for proxied operation: the 'lzproxied' query parameter, and the proxied attribute of the <canvas> document root element. Either of these can specify that the application is proxied, that it is SOLO (unproxied), or that whether it is proxied is determined by another source. If both of these mechanisms are used, they must agree, otherwise it is a compiler error (for example, a ?proxied=true request for an application that contains <canvas proxied="false">). If neither is used, the application is proxied.
Because the OpenLaszlo Server contains the compiler, developing and deploying steps can be intertwined, depending on the values of certain parameters. Various options are presented here and summarized below.
For security (to prevent malicious use), the Flash player requires that swf programs demonstrate that they have permission to access any files that they reference. There are two ways to do this.
If the files originate from the same domain as the application, access is allowed.
If the files do not originate from the same domain as the application, there must be a crossdomain.xml file at the top level of the domain from which they are served.
For instance, say you have an OpenLaszlo application that uses art assets from a remote source:
<resource name="prettypicture" src="http://someURL/picture.gif"> |
where someURL is different from where the application is served. Flash requires that a properly configured crossdomain.xml file be present at the top level of that domain to give you permission to access the file. For instructions on how to do this, see the Macromedia documentation.
Applications that are proxied do not need to do this, since the OpenLaszlo server proxies all requests, and therefore from the point of view of the application on the client, all data is coming from the same place.
The development process for serverless applications is a simple variation on the usual Laszlo cycle:
# Develop the application using OpenLaszlo Server
# Compile static (.swf) files
# Place application files on web server
Compiling dir/canvas.lzx creates the file dir/canvas.lzx.swf.
There are two ways to compile an application to be deployed SOLO:
Precompiling the application by invoking the compiler from the command line
Compiling the application using OpenLaszlo Server and specifying unproxied deployment, as explained below.
The compiler resides in the directory:
3.3.3#/bin |
Invoke the compiler with the command:
lzc filename.lzx
|
This will result in creation of the file:
filename.swf
|
in same directory as the source. The compiled file can be deployed by any application server, such as apache.
Alternatively you can cause the compilation as a side effect of requesting unproxied deployment, as explained in the next section.
You can specify deployment by using:
the lzproxied query parameter to the lzx request type in the URL, for example http://somedomain.com/laszlo-app.lzx?lzproxied=false
the proxied attribute in the <canvas> tag.
the query parameter and attribute together.
Requesting a SOLO application /path/to/canvas.lzx has the side effect of creating a file /path/to/canvas.lzx.swf. This file, or the directory that contains this file, can be copied to the htdoc directory of a server that doesn't include the Openlaszlo Server.
The file is called canvas.lzx.swf instead of canvas.swf to preserve OpenLaszlo "branding"—just as the presence of .php or .jsp in a URL is good for the awareness of PHP and Java, even though .htaccess can be configured not to require this filename extensions in the URL. This also makes it less likely that compiling an application (for example, logo.lzx) will overwrite a file that it includes (if logo.lzx includes logo.swf).
The file is placed in the same directory as the source file so that relative references to datasets and media requests will work.
The proxied attribute on the <canvas> tag can take the following values:
true: the application is proxied by the OpenLaszlo Server
false: the application is not proxied
inherit: the value is determined by the lzproxied query parameter
The query parameter to the application request URL, for example 'http://lps-3.0/hello.lzx', specifies whether the application is compiled for proxied or unproxied operation. The lzproxied parameter can take the values true and false. If true, the application is proxied by the OpenLaszlo Server. If false, the application is deployed SOLO.
Add a query parameter, 'lzproxied', to the application request URL. For example, 'http://lps-3.0/hello.lzx?proxied=true'. Like the 'debug' query parameter, this parameter acts as a compiler option, and affects the way an application is compiled.
{|
! lzproxied query parameter
! <canvas proxied=>
! result
|-
| not present || not present || proxied
|-
| not present || inherit || proxied
|-
| not present || true || proxied
|-
| not present || false || unproxied
|-
| true || not present || proxied
|-
| true || inherit || proxied
|-
| true || true || proxied
|-
| true || false || error
|-
| false || not present || unproxied
|-
| false || inherit || unproxied
|-
| false || true || error
|-
| false || false || unproxied
|}
|
The existence of the query parameter means that an application can work in either proxied or SOLO mode, can be compiled for either mode without changes to its source code. In particular, this makes it easy to compare the proxied and unproxied operation of an application, and to hold off on committing to the deployment mode for an application.
The existence of the query parameter also makes it possible to implement an HTTP-based user interface (in the form of additional controls on the developer console) for specifying compiler options.
It is also consistent with the debug and runtime target compiler options.
See Chapter 32, Browser Integration for a discussion of how to deploy OpenLaszlo applications within HTML pages. Here's a summary of how this process needs to be modified for SOLO applications.
If you are deploying a SOLO application using LzEmbed and wish to pass parameters down to the application from the base URL, you need to make some modifications to the stock html wrapper page that the server provides.
Here is an lzEmbed line that passes all of the query parameters down to the OpenLaszlo application undamaged:
lzEmbed({url: 'main.lzx.swf?'+window.location.search.substring(1), bgcolor: '#ffffff', width: '100%', height: '100%'});
|
The thing that's different is the alteration to main.lzx.swf? from main.lzx?lzt=swf and the addition of '+window.location.search.substring(1)'
During development, an HTTP request for a SOLO application that is backed by /path/to/canvas.lzx may cause the compiler to create a file /path/to/canvas.lzx.swf (the object file). Recompilation occurs when all of the following conditions are true:
The allowRecompile OpenLaszlo Server configuration property is 'true'
The compMgrDependencyOption OpenLaszlo Server configuration property is not 'never'
One or more of the following conditions is true:
The object file does not exist
The object file is older than any of the application source files
The value of the allowRecompile property is 'always'
An HTTP request for a SOLO application returns the object file from the source directory instead of from the OpenLaszlo Server cache.
Using the OpenLaszlo Server, request the application URL.
Copy the .lzx.swf file to a directory on the deployment server.
This is necessary to deploy an application that consists of several deployment files; for example, data and media files in the source directory that are requested during application execution.
Using the OpenLaszlo Server request the application URL.
Copy the source directory to the deployment server.
You can chose whether or not to make visible the source code to your application. When you want to make sure that your source is not available, do this:
Using the OpenLaszlo Server, request the application URL.
Make a copy of the source directory. The copy is the "staging directory".
Remove all .lzx files from the staging directory.
Remove any other data and media files that are not referenced during application execution.
Copy the staging directory to the deployment server.
Here are examples of applications that do not require the OpenLaszlo server at run time:
Example 22.1.
<canvas proxied="false">
<datasource name="ds" src="http:data.xml" request="true"/>
<text datapath="ds:/root/text()"/>
</canvas>
|
with these support files:
lib-ds-proxied.lzx: |
Example 22.4.
<library proxied="true">
<datasource name="ds" src="http:data.xml" request="true"/>
<text datapath="ds:/root/text()"/>
</library>
|
lib-ds-unproxied.lzx: |
Example 22.5.
<library proxied="false">
<datasource name="ds" src="http:data.xml" request="true"/>
<text datapath="ds:/root/text()"/>
</library>
|
lib-ds-default.lzx: |
Example 22.6.
<library proxied="default">
<datasource name="ds" src="http:data.xml" request="true"/>
<text datapath="ds:/root/text()"/>
</library>
|
These programs create applications that use the OpenLaszlo Server to proxy the dataset request:
Example 22.7.
<canvas proxied="true">
<datasource name="ds" src="http:data.xml" request="true"/>
<text datapath="ds:/root/text()"/>
</canvas>
|
Compiler errors are returned for these cases:
A proxied canvas that includes an unproxied library:
Example 22.10.
<canvas proxied="true">
<!--Error:proxied canvas that includes an unproxied library:-->
<include href="lib-ds-unproxied.lzx"/>
</canvas>
|
A unproxied canvas that includes a proxied library:
Media requests use the global canvas attribute.
These programs make media requests through the server:
This example shows a data request that is mediated by the OpenLaszlo Server:
This program makes a direct (serverless) media request:
Copyright © 2002-2005 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.