Table of Contents
This document briefly describes OpenLaszlo request types. It assumes that you are generally familiar with HTTP, URLs, and the OpenLaszlo architecture described in Chapter 1, OpenLaszlo Architecture.
In general, an URL that is used to request a proxied OpenLaszlo application is of the form:
http://myhost[:myport]/mywebapp/myapp.lzx?lzt=type |
Everything before the ? character can typically be configured via settings in your Servlet Container and/or Web Server. The value of the lzt query parameter is interpreted by the OpenLaszlo Server as a request type. Here are the standard request types:
These request types return an HTML page that displays the application. The mime-type of the response is text/html.
This request causes the OpenLaszlo Server to respond with an HTML wrapper page for the Laszlo application. The HTML page presents the application. The title and background color of the application are set to the title and background color of the application (the values of its canvas title and bgcolor attributes, if present).
The page that this SWF returns uses JavaScript to include the OpenLaszlo application.
Same as lzt=html, except this page embeds the <object> and <embed> tags directly in the HTML page. This is the traditional technique for including applications that is used on most web sites, but it is incompatible with the announced changes to Internet Explorer.
Show the application in a popup window sized to the canvas.
These request types are used to embed an application in an HTML page. Different requests are available depending on the request is included on the server (object-tag) or the client (everything else); whether the embedding technique is compatible with the announced changes to Internet Explorer (embed and js) or uses traditional embedding techniques (object-tag), and whether it creates <object> and <embed> tags (embed, js, and object-tag) or simply returns the swf file that contains the application (swf).
Returns a JavaScript include file that is suitable for the target of an HTML <script> tag. The file embeds the application into the HTML page at the site of the <script> tag. This is appropriate for including an application in a way that is compatible with the announced changes to Internet Explorer.
Usage:
<script type="text/javascript" language="JavaScript"
src="http://localhost:8080/lps-3.3.3/examples/hello.lzx?lzt=embed">
</script> |
Same as lzt=embed, except the included file depends on the functions defined in the embed.js file.
Usage:
<html>
<head>
…
<script type="text/javascript" language="JavaScript"
src="http://localhost:8080/lps-3.3.3/lps/includes/embed.js"/ >
</head>
<body>
…
<script type="text/javascript" language="JavaScript"
src="http://localhost:8080/lps-3.3.3/examples/hello.lzx?lzt=js">
</script>
…
</body>
</html>
|
Returns the HTML <object> and <embed> tags that embed the application into an HTML page. This is useful for server-side includes, when compatability with the announced changes to Internet Explorer is not necessary.
Returns the SWF file that represents the application, without any HTML. This is used to embed a Laszlo application in an HTML page. (Most of the other request types generate code that includes a URL with this request type.) The mime-type returned by this request is application/x-shockwave-flash.
This request causes the OpenLaszlo Server to respond with an HTML wrapper page for the OpenLaszlo application. The HTML page presents the application. It also displays compilation warnings for the application, and links to development environment commands and developer resources. These commands are described here.
This is the default request. If no lzt query string variable is present, the value is assumed to be html.
The mime-type returned by this request is text/html.
Show the source in a <textarea> HTML element. The mime-type returned by this request is text/html.
Show the source as plain XML (for XML-aware browsers). The mime-type returned by this request is text/xml.
The debug=true query parameter can be used to include the debugger in an application.
The debuglog=true query parameter can be used to log debug messages to the server log.
The ?lzrecompile=true query parameter can be used to force the OpenLaszlo Server to recompile an application (.lzx only, not .lzo) even when the compilation manager's dependency option is set to never. (See Chapter 4, Deploying OpenLaszlo Applications for details on the compilation manager's dependency option). If the administrator password is set, you must also provide the password in pwd= query parameter for the recompile to take effect.
The ?pwd=passwd query string can be used to pass in the OpenLaszlo Server administrative password.
A running OpenLaszlo application can get access to any of the query strings that was given in the URL used to access it via the LzBrowser service's getInitArg() method. For example if the following URL:
http://host:port/myapps/wooker.lzx?wookie=Chewie
|
were used to access the following app:
Example 3.1. Accessing query strings
<canvas debug="true">
<script>
var wookieName = LzBrowser.getInitArg('wookie');
Debug.write("The Wookie's Name: " + wookieName);
</script>
</canvas>
|
the debugger would display
The Wookie's Name: Chewie
|
Note that query strings that conflict with the OpenLaszlo Runime Library's global namespace will be lost (for example, "canvas" or "bgcolor").
A password may be required for Administrative Requests. See Chapter 4, Deploying OpenLaszlo Applications for more details.
Show the current log file as text/html.
Clears the current log file.
Show OpenLaszlo Server log4j configuration as text/xml.
Clear OpenLaszlo Server media, data, and compilation caches. Return a text/html status message.
Show OpenLaszlo Server configuration information as text/xml.
Show OpenLaszlo Server media and data cache information as text/xml.
Show the number of OpenLaszlo Server errors as text/xml.
Clear OpenLaszlo Server error count.
Monitor server statistics.
Run the garbage collector.
The OpenLaszlo Server also supports using dynamic, server-side back-end processors (e.g., PHP, JSP) to generate LZX application source code before the OpenLaszlo Server compiles and serves it. For URLs that end in .lzx for which the OpenLaszlo Server can not find a matching source file on disk, the Server removes the .lzx suffix and uses HTTP GET to retrieve the content of the modified URL. The returned content should be a valid LZX file. The OpenLaszlo Server compiles and serves an application based on the dynamically generated source code. For example see the hello.jsp file in the examples directory. This example generates a Laszlo application that contains information about the current time and session. You can see the generated LZX source at:
http://localhost:8080/lps-3.3.3/examples/hello.jsp.lzx?lzt=source |
and the generated application at:
http://localhost:8080/lps-3.3.3/examples/hello.jsp.lzx |
The use of dynamically generated LZX circumvents the OpenLaszlo Server compilation cache, and compiles an application for each request. This is not recommended for use in deployment. Dynamic behavior is best handled by a static application that requests data and resources from the server during its initialization.
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.