加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

创建flex的web工程的方法(总结)

发布时间:2020-12-15 01:00:46 所属栏目:百科 来源:网络整理
导读:? 服务器端,用eclipse建立web工程 ? 1.建立web工程(这里取名test) ? 2.在WEB-INF下创建flex文件夹 ? 3.在flex文件夹下创建4个xml文件 ?? (1)messaging-config.xml ????? ?xml?version="1.0"?encoding="UTF-8"??? service?id="message-service"??? ????class=
?

服务器端,用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)点完成

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读