/******************************************************************************************************************/
//Deploying your application
//Version 1.3
//
//*****************************************************************************************************************/
Flex Builder setup suggestions
Flex Builder 设置建议
For improved performance(工作性能), adjust(调整, 调节, 校准, 使适应)your Flex Builder settings as follows:
为了提高工作性能,按照下面的设置调整你的Flex builder。
Click Project > Properties > Flex Compiler, then uncheck the Enable integration with browser navigation check box. Unless you have added code to specifically support deep links, there is no need for this box to be checked.
Click Project > Properties > Flex Build Path > Library Path and set Framework linkage to Runtime Shared Library (RSL). Read more about RSL, a new feature supported by Flash Player 9.0.115 and later.
Click Project > Properties > Flex Compiler and set the required Flash Player version to 9.0.115 or later.
Compiling an optimized SWF file
编译一个优化的SWF文件
When you compile your application in Adobe Flex Builder 3, a debug version is created. While useful for development purposes, this is not optimal for deployments.
When you are ready to deploy(部署、调动)your application, use Adobe's Flex Export Release Build process to create an optimized release-quality version of your SWF file:
1. In Flex Builder 3, click Project > Export Release Build from the main menu.
2. Click Finish.
Production workflow (or when do I need a crossdomain file?)
The compiled application (SWF file), its HTML wrapper, and its related files (e.g., shared libraries) can be moved onto any Web server. There are no dependencies on any additional files hosted by you, or ESRI, at runtime because the compiled SWF contains all the necessary code.
当你在Adobe Flex Builder 3.0中编译你的应用程序,就会创建一个Debug版本。这对开发是有益的,但是对部署却不是最佳的选择。
当你准备不熟你的应用程序的时候,使用Adobe的Flex export 版本的构建处理来创建一个优化的、发布质量版本的SWF文件。
1. In Flex Builder 3, click Project > Export Release Build from the main menu.
2. Click Finish.
生产流程(或者是否需要一个crossdomain file[跨域访问文件])
编译后的应用程序(SWF文件),她的HTML包装,以及他相关的文件可以部署到其他任何的网络服务器。她不依赖于任何由你或者ESRI创建的附加文件,这是因为在运行的时候SWF文件包含所有的需要的文件。
When a Web user accesses the HTML wrapper file, the browser will verify(vt.核实,查对;证明,证实) that Adobe Flash Player is installed and using the specified minimum Flash Player version. The client browser will then download the SWF file. After this point, the user might not connect back to this Web server at all but rather directly to the servers containing map content and tasks. Note that if your web application is not hosted on the same server as the ArcGIS Server, you will have to have a crossdomain.xml on the ArcGIS Server.
About crossdomain.xml
当一个web用户访问一个HTML文件的时候,浏览器见会检查ADOBE flash 播放器是否安装和是否使用了允许的最低版本的播放器。客户单浏览器然后才加载SW文件。 此时,用户也许根本不会连接这个web 服务器,而是直接的指向包含地图内容和任务的服务器。需要注意的是,你的web应用程序如果不和ArcGISSserver服务部署到同一台服务器,那么你必须在ArcGISServer服务器上部署一个CrossDomain.xml文件。(支持Flex的跨域访问)
To access data from a different server than the one hosting your Flex application, the remote server needs to have a cross-domain file in the root directory. For security reasons, the Web browser cannot access data that resides outside the exact Web domain where the SWF file originated. However, Adobe Flash Player can load data across domains if permission is granted from the server. This is accomplished by including a small crossdomain.xml file on the remote server that permits Flash to connect to services on that server. For instance:
为了访问另外一个服务器中的数据而不是你应用程序所在的服务器,远程的服务需要一个cross-domian文件放置到IIS的根目录下面。基于安全的考虑,web浏览器不能访问SWF文件存在的web域之外的数据。(注释:指浏览器不能访问非本地的SWF文件)。尽管如此,如果从服务器端生成一个访问许可,Adobe播放器就可以跨域加载数据。这个可以通过在远程服务器端包含一个小的crossdomain.xml文件,它可以允许Flash连接服务器端的服务。比如:
//下面的代码就是一个完整的跨域访问文件
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*"/>
</cross-domain-policy>
For additional information, read Using cross-domain policy files in the Adobe Flex 3 Help, see the Adobe TechNote "External data not accessible outside a Macromedia Flash movie's domain," or view a sample cross-domain file.
Deploying crossdomain.xml
To deploy the cross-domain file on ArcGIS Server, see the instructions specific to your platform.
o .NET
Add crossdomain.xml to your Web server root directory, for example, C:\inetpub\wwwroot.
o Java
Add crossdomain.xml to <ArcGIS_Server_Install_Location>\ArcGIS\java\web_output, for example, C:\Program Files\ArcGIS\java\web_output.
更多个信息,阅读Adobe flex 3 帮助中的Using cross-domain policy files部分,查看External data not accessible outside a Macromedia Flash movie's domain,部分,或者浏览一个Cross-domain.xml文件的例子。
部署crossdomain.xml文件
为了部署crossdomain.xml文件到ArcGISServer服务器端,查看指定平台下的介绍。
。NET下
添加crossdomain.xml文件到你的web服务的根目录下(也就是IIS的根目录),比如:C:\inetpub\wwwroot.
。JAVA平台下
添加crossdomain.xml文件到<ArcGIS_Server_Install_Location>\ArcGIS\java\web_output路径下面,例如:C:\Program Files\ArcGIS\java\web_output.
//总结:
本章介绍的重点是:FLex跨域访问的安全问题,adobe不允许跨访问远程的服务,因此我们需要在目标服务器中放置一个Cross-domain.xml文件来表示该服务器上的服务允许远程的访问。这是Adobel的安全机制。