How the web-tier compiler works

来源:互联网 发布:mac怎么连接电视 编辑:程序博客网 时间:2024/05/22 13:26

Introduction

 

Contents [Hide]


 

The Adobe® Flex® module for Apache and IIS compiler provides web-tier compilation of MXML files on Apache and IIS web servers. This lets you rapidly compile, test, and deploy an application: Instead of compiling your MXML file into a SWF file and then deploying it and its wrapper files on a web server, you can just refresh the MXML file in your browser.

You do not need a Java 2 Enterprise Edition (J2EE) server to use the web-tier compiler. The Flex module for Apache and IIS works with just the web server and a Java Runtime Environment (JRE).

This document refers to the Flex module for Apache and IIS as the web-tier compiler or the compiler module.

For web tier compilation, you can also use the Adobe Flex compiler module for J2EE application servers. The Flex compiler module for J2EE application servers is a ZIP file that you can deploy to most J2EE application servers that support servlets. The Flex compiler module for J2EE application servers also provides a JSP tag library that lets you write Flex applications in JSPs. It is available as a download on the Adobe web site.

How the web-tier compiler works

This process contains the following steps:

  1. The client requests a file with an *.mxml file extension.

  2. The web server forwards the request to the compiler module.

  3. The compiler module compiles the MXML file into a SWF file. The compiler module uses incremental compilation, so most compilations after the first one take less time to complete.

  4. The compiler module returns an HTML file to the web server, which returns it to the client.

  5. If the SWF file was compiled successfully, the HTML page embeds the SWF file. If the HTML file is an error page, the SWF file is not embedded in the HTML page and no further requests are made.

  6. The client then requests the SWF file based on the contents of the wrapper’s <object> and <embed> tags, if a current version of the SWF file is not in its local file cache.

When the web server receives a request for a file with the extension *.mxm.swf instead of *.mxml, the compiler module returns a SWF file only, and not the wrapper around it. In general, you should not request a SWF file directly, because it may run differently than if it were embedded in a wrapper.

The web-tier compiler has the following advantages over using the command-line compiler:

  • Provides incremental compilation (recompiles only the bits that have changed, not necessarily the entire application).

  • Saves you from having to deploy the SWF file and wrapper files after compiling.

  • Lets you customize the HTML wrapper or template.

  • Lets you debug by adding a query string parameter (?debug=true).

  • Helps you share updates to your application across working groups by sending a link to the web server.

  • Displays error and warning messages in the browser.

The web-tier compiler has the following disadvantages compared to using the command-line compiler:

  • Not for production use.

  • No built-in support for Express Install, deep linking, or version detection.

  • Caching relies on the web server.

  • On Linux systems, when you compile certain applications you may get an error message about not having a graphical display. This is due to the Java compiler being run by the Apache user, which does not have access to the desktop. To overcome this, add the following line to the flex-config.xml file used by the compiler:

    <headless-server>true</headless-server>

原创粉丝点击