博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
创建flex的web工程的方法(总结)
阅读量:4212 次
发布时间:2019-05-26

本文共 11851 字,大约阅读时间需要 39 分钟。

 

服务器端,用eclipse建立web工程

 

1.建立web工程(这里取名test)

 

2.在WEB-INF下创建flex文件夹

 

3.在flex文件夹下创建4个xml文件

   (1)messaging-config.xml

     

<?xml version="1.0" encoding="UTF-8"?>  
  1. <service id="message-service"   
  2.     class="flex.messaging.services.MessageService">  
  3.     <adapters>  
  4.         <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" />  
  5.         <!-- <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/> -->  
  6.     </adapters>  
  7.     <default-channels>  
  8.         <channel ref="my-polling-amf"/>  
  9.     </default-channels>  
  10. </service>  

   (2)proxy-config.xml

     

<?xml version="1.0" encoding="UTF-8"?>  
  1. <service id="proxy-service"   
  2.     class="flex.messaging.services.HTTPProxyService">  
  3.     <properties>  
  4.         <connection-manager>  
  5.             <max-total-connections>100</max-total-connections>  
  6.             <default-max-connections-per-host>2</default-max-connections-per-host>  
  7.         </connection-manager>  
  8.         <allow-lax-ssl>true</allow-lax-ssl>  
  9.     </properties>  
  10.     <adapters>  
  11.         <adapter-definition id="http-proxy" class="flex.messaging.services.http.HTTPProxyAdapter" default="true"/>  
  12.         <adapter-definition id="soap-proxy" class="flex.messaging.services.http.SOAPProxyAdapter"/>  
  13.     </adapters>  
  14.     <default-channels>  
  15.         <channel ref="my-amf"/>  
  16.     </default-channels>  
  17.     <destination id="DefaultHTTP">  
  18.     </destination>  
  19. </service>  

   (3)services-config.xml

     

<?xml version="1.0" encoding="UTF-8"?>  
  1. <services-config>  
  2.   
  3.     <services>  
  4.         <service-include file-path="remoting-config.xml" />  
  5.         <service-include file-path="proxy-config.xml" />  
  6.         <service-include file-path="messaging-config.xml" />  
  7.     </services>  
  8.   
  9.     <security>  
  10.         <login-command  
  11.             class="flex.messaging.security.TomcatLoginCommand" server="Tomcat" />  
  12.         <!-- Uncomment the correct app server  
  13.             <login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss">  
  14.             <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>          
  15.             <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>  
  16.             <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>  
  17.         -->  
  18.   
  19.         <!--   
  20.             <security-constraint id="basic-read-access">  
  21.             <auth-method>Basic</auth-method>  
  22.             <roles>  
  23.             <role>guests</role>  
  24.             <role>accountants</role>  
  25.             <role>employees</role>  
  26.             <role>managers</role>  
  27.             </roles>  
  28.             </security-constraint>  
  29.         -->  
  30.     </security>  
  31.   
  32.     <channels>  
  33.   
  34.         <channel-definition id="my-amf"  
  35.             class="mx.messaging.channels.AMFChannel">  
  36.             <endpoint  
  37.                 url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"  
  38.                 class="flex.messaging.endpoints.AMFEndpoint" />  
  39.         </channel-definition>  
  40.   
  41.         <channel-definition id="my-secure-amf"  
  42.             class="mx.messaging.channels.SecureAMFChannel">  
  43.             <endpoint  
  44.                 url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure"  
  45.                 class="flex.messaging.endpoints.SecureAMFEndpoint" />  
  46.             <properties>  
  47.                 <add-no-cache-headers>false</add-no-cache-headers>  
  48.             </properties>  
  49.         </channel-definition>  
  50.   
  51.         <channel-definition id="my-polling-amf"  
  52.             class="mx.messaging.channels.AMFChannel">  
  53.             <endpoint  
  54.                 url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling"  
  55.                 class="flex.messaging.endpoints.AMFEndpoint" />  
  56.             <properties>  
  57.                 <polling-enabled>true</polling-enabled>  
  58.                 <polling-interval-seconds>4</polling-interval-seconds>  
  59.             </properties>  
  60.         </channel-definition>  
  61.   
  62.         <!--  
  63.             <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">  
  64.             <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>  
  65.             </channel-definition>  
  66.               
  67.             <channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel">  
  68.             <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>  
  69.             <properties>  
  70.             <add-no-cache-headers>false</add-no-cache-headers>  
  71.             </properties>  
  72.             </channel-definition>  
  73.         -->  
  74.     </channels>  
  75.   
  76.     <logging>  
  77.         <target class="flex.messaging.log.ConsoleTarget"  
  78.             level="Error">  
  79.             <properties>  
  80.                 <prefix>[BlazeDS]</prefix>  
  81.                 <includeDate>false</includeDate>  
  82.                 <includeTime>false</includeTime>  
  83.                 <includeLevel>false</includeLevel>  
  84.                 <includeCategory>false</includeCategory>  
  85.             </properties>  
  86.             <filters>  
  87.                 <pattern>Endpoint.*</pattern>  
  88.                 <pattern>Service.*</pattern>  
  89.                 <pattern>Configuration</pattern>  
  90.             </filters>  
  91.         </target>  
  92.     </logging>  
  93.   
  94.     <system>  
  95.         <redeploy>  
  96.             <enabled>false</enabled>  
  97.             <!--   
  98.                 <watch-interval>20</watch-interval>  
  99.                 <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>  
  100.                 <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file>  
  101.                 <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file>  
  102.                 <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file>  
  103.                 <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file>  
  104.                 <touch-file>{context.root}/WEB-INF/web.xml</touch-file>  
  105.             -->  
  106.         </redeploy>  
  107.     </system>  
  108. </services-config>  

      

   (4)remoting-config.xml

     

<?xml version="1.0" encoding="UTF-8"?>  
  1. <service id="remoting-service"   
  2.     class="flex.messaging.services.RemotingService">  
  3.   
  4.     <adapters>  
  5.         <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>  
  6.     </adapters>  
  7.   
  8.     <default-channels>  
  9.         <channel ref="my-amf"/>  
  10.     </default-channels>  
  11.     <!-- 主要是这里配置 -->  
  12.     <destination id="remoteService">  
  13.         <properties>  
  14.             <source>com.hx.osworkflow.service.WorkflowService</source>  
  15.         </properties>  
  16.     </destination>  
  17. </service>  

 

 

4.在web.xml里面加入:

  

<servlet>  
  1.     <servlet-name>MessageBrokerServlet</servlet-name>  
  2.     <servlet-class>  
  3.         flex.messaging.MessageBrokerServlet  
  4.     </servlet-class>  
  5.     <init-param>  
  6.         <param-name>services.configuration.file</param-name>  
  7.         <param-value>/WEB-INF/flex/services-config.xml</param-value>  
  8.     </init-param>  
  9.     <load-on-startup>1</load-on-startup>  
  10. </servlet>  
  11. <servlet-mapping>  
  12.     <servlet-name>MessageBrokerServlet</servlet-name>  
  13.     <url-pattern>/messagebroker/*</url-pattern>  
  14. </servlet-mapping>  
  

 

 

在客户端用flex Builder建立工程(这里叫test-client)

 

(1)Flex project,Application type选择Web application(runs in Flash Player)

     Server technology里面Application server type选择ColdFusion, 在Use remote

     object access service里面选择ColdFusion Flash Remoting,点下一步

 

(2)Web root,Root URL,还有Context root跟你的建的web工程保持一致, 点下一步

    (注意这时服务器必须已经启动)

 

(3)点完成

转载地址:http://vnzmi.baihongyu.com/

你可能感兴趣的文章
yii2 - 增加actions
查看>>
php图像处理函数大全(缩放、剪裁、缩放、翻转、旋转、透明、锐化的实例总结)
查看>>
magento url中 uenc 一坨编码 base64
查看>>
强大的jQuery焦点图无缝滚动走马灯特效插件cxScroll
查看>>
Yii2.0 数据库查询
查看>>
yii2 db 操作
查看>>
mongodb group 有条件的过滤组合个数。
查看>>
关于mongodb的 数组分组 array group
查看>>
MongoDB新的数据统计框架介绍
查看>>
mongodb 增加全文检索索引
查看>>
symfony
查看>>
mysql数据库主从同步的问题解决方法
查看>>
LoadRunner如何在脚本运行时修改log设置选项?
查看>>
QC数据库表结构
查看>>
自动化测试工具的3个关键部分
查看>>
测试工具厂商的编程语言什么时候“退休”?
查看>>
资源监控工具 - Hyperic HQ
查看>>
LoadRunner中Concurrent与Simultaneous的区别
查看>>
SiteScope - Agentless监控
查看>>
使用QTP的.NET插件扩展技术测试ComponentOne的ToolBar控件
查看>>