原文:http://www.nomanland.net/2010/05/21/flex-series-guide-integration2/
Spring BlazeDS Integration 是什么?
Spring BlazeDS Integration 是 SpringSource 的開源項目,用於整合 Spring 與 BlazeDS。
為什么需要 Spring BlazeDS Integration?
正如“Flex4系列教程之六”介紹的:不使用 Spring BlazeDS Integration 同樣可以整合 Spring 與 BlazeDS。但這種整合方式不自然,需要額外維護一個 BlazeDS 配置文件,Spring BlazeDS Integration 會改善這種處境。
Spring BlazeDS Integration 需要的軟件環境:
Spring BlazeDS Integration 特征
注意事項:
第一步:准備所需 jar 包
將以下 3 部分 jar 包拷貝到 sampleApp 項目的 lib 下
第二步:修改 web.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app
id="WebApp_ID"
version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>zara</display-name>
<context-param>
<param-name>flex.class.path</param-name>
<param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
</context-param>
<!-- Http Flex Session attribute and binding listener support -->
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!-- 定義spring 以及 spring flex 集成的配置 -->
<servlet>
<servlet-name>MessagebrokerServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/META-INF/applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map /spring/* requests to the DispatcherServlet -->
<servlet-mapping>
<servlet-name>MessagebrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<!-- 定義spring 以及 spring flex 集成的配置 結束-->
<!-- 訪問RDS 定義開始-->
<servlet>
<servlet-name>RDSDispatchServlet</servlet-name>
<display-name>RDSDispatchServlet</display-name>
<servlet-class>flex.rds.server.servlet.FrontEndServlet</servlet-class>
<init-param>
<param-name>useAppserverSecurity</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>messageBrokerId</param-name>
<param-value>_messageBroker</param-value>
</init-param>
<load-on-startup>10</load-on-startup>
</servlet>
<servlet-mapping
id="RDS_DISPATCH_MAPPING">
<servlet-name>RDSDispatchServlet</servlet-name>
<url-pattern>/CFIDE/main/ide.cfm</url-pattern>
</servlet-mapping>
<!-- 訪問RDS 定義結束 -->
</web-app>
第三步:配置 web-application-config.xml
第四步:配置 springFlex.xml
第五步:編寫后台Bean,使用標簽@RemotingDestination來透出接口,給flex client調用
注意:為了使用FB4 中的 (數據/服務)功能。在編輯器中可以訪問后端的java bean。
必須在建立項目的時候,先建立一個web項目,然后再加入flex project的性能的方法。使得這個項目具有web應用和flex應用2重性。
不能直接建立一個flex project 選中使用WTP整合java/flex的功能。否則在IDE下無法使用(數據/服務)菜單訪問后台的bean。
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。