Deploying OpenLaszlo Applications – a crash test manakin’s guide:
By Stewart Sims (CC licence on sidebar)
This article will attempt to describe in simple terms the steps required in order to deploy your own openlaszlo application on the web. Although I’ve tried to keep it as straightforward as possible you will at least need your own application and if you intend to deploy on a web-site, you must have your own web hosting that provides a servlet container or application server such as Apache Tomcat.
If you’re really stuck for apps you can always use the provided ‘hello world’ application that comes with every package of openlaszlo, but I thoroughly recommend you check out OpenLaszlo Explorer which will have you developing OL apps in minutes. Start OL server and it should open automatically, if not surf to: http://127.0.0.1:8080/lps-4.3.0/laszlo-explorer/index.jsp . There is also a web version on the OpenLaszlo website.
From here onwards I will refer to OpenLaszlo as OL to save everyone too much of a headache.
There are two methods of OL application deployment: SOLO mode and Proxied mode
To deploy applications in either mode on your development machine, for testing for example, you simply begin the full OL server (which if you haven’t already got, download from the openlaszlo website). Then as discussed previously you can surf to the actual .lzx file to use it in the development console, use the URL:
(127.0.0.1:8080 is the localhost on the 8080 port, which means your OL server on your development machine. It will only load if you have started the OL server.)
The development console provides a panel to gain access to debugging and deployment tools, sometimes in Internet Explorer however it doesn’t display, try loading into a different browser or alternatively you can find all the OL development tools at:
Here you will find tools for deploying apps in both modes, simply follow the instructions.
Once you have developed a successful OL application, in order to run it on your website, you must deploy it on your deployment machine. You need to make a choice about which way you want to do this:
SOLO mode is the easiest way of deploying things, the .lzx program is compiled into a flash .swf which can then be uploaded onto a web server. You can embed the flash file into a HTML page in order to make it more useful and integrate OL features into your website. It is as simple as deploying the program on your development machine using the SOLO deployment admin tool, and then copying the .swf file and if needed wrapper HTML onto your web host.
Proxied mode is the full-blown OL web application deployment mechanism, and you need to use it if you want your OL application to have two way communication with the server for example if you are manipulating data or need the application to make a HTTP request. Proxied mode essentially requires deployment of the OL server itself along with your program. This is easy to do on your development machine because it is already set up in the full OL server install. However deploying it onto your web deployment machine is a bit trickier.
The remainder of this article will deal with deploying OL apps using the proxied mode.
- Firstly you need to know that OpenLaszlo server is essentially itself a web application that runs on servlet containers and app servers such as Apache Tomcat. Your OL apps communicate with the OL server web app in order to run in proxied mode
- The OL server and therefore your web apps are in fact built using the Java servlet API. What this means to you is that you will be deploying a Java web application on your deployment machine.
- The easiest way to deploy your OL apps in proxied mode is to deploy them with your OL server as follows.
Note: this requires use of the java development kit (JDK), please download if you don’t already have it
1. Firstly download the OpenLaszlo minimal ‘servlet’ server provided on the OpenLaszlo website, place it in it’s own seperate folder on your development machine.
2. Unpack this web application archive (.war file) using the java command line tool:
jar -xf nameofopenlaszlowarfile.war
3. Delete the .war and put your own .lzx program(s) into the my-apps folder.
4. Package the war back up using the java packaging tool in command line as follows:
jar cf whatyouwanttocallyourwar.war *
You must be in the correct folder in the command line in order for this to work, navigate to it using the ‘cd’ command.
Now you have your own version of the OL server to deploy with your applications. The next stage is to upload it to your web server. As the OL server installation is fairly large (40+mb) and broadband upload sometimes unreliable you may want to use a more robust method than a ‘web disk’ such as ftp or some ‘legacy’ upload tool designed for uploading large files.
Hopefully, if your web server with Apache Tomcat (or similar servlet container) is set up correctly, once the file is uploaded it should automatically unpack the file and run the OL server. You will know if this has happened if a folder appears on your server of the name that you used for your .war file.
Test your web app by surfing to the folder in question and then the /my-apps/ folder. For example.
8080 is the default apache tomcat port, you may need a different port for your server.
?lzt=html, tells OL server to return a basic ‘invisible’ HTML wrapper page with the .swf file embedded. This is the easiest method of running the app and it avoids the development console appearing which is obviously not something the users want to see.
So with a bit of luck, you should now be able to get your own OpenLaszlo programs up and running on a web server of your own.
Remember that these applications on their own do not necessarily serve much purpose, there is no advantage over an ordinary standalone application other than the fact that they are web-accessible. You need to give some thought to how you want the app to interact with the input data and where to output it to. With that said used wisely proxied mode OL applications can provide an excellent platform to develop dynamic, and perhaps even exciting applications. I’m currently learning how best to use it from a business perspective, but there’s nothing to say you can’t develop some very nice media programs or games with it.