准备:
1、下载Spring BlazeDS Integration:
http://www.springsource.org/spring-flex
2、将下载回来的jar放置到我们之前创建的blazeds项目
http://depravedangel.iteye.com/blog/871480lib下
整合:
1、将原来flex提供的MessageBroker
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
替换成Spring MVC 控制
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<servlet-mapping>
<url-pattern>/spring/*</url-pattern>
</servlet-mapping>
2、将blazeds/WEB-INF/flex/services-config.xml中
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint
url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint" />
</channel-definition> -->
替换成Spring的url,交由spring过滤
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/spring/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
3、打开applicationContext.xml,添加如下bean:
<!-- Maps request paths at /* to the BlazeDS MessageBroker -->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>/*=springManagedMessageBroker</value>
</property>
</bean>
<!-- Dispatches requests mapped to a MessageBroker -->
<bean class="org.springframework.flex.messaging.servlet.MessageBrokerHandlerAdapter" />
<!-- Bootstraps and exposes the BlazeDS MessageBroker -->
<bean id="springManagedMessageBroker" class="org.springframework.flex.messaging.MessageBrokerFactoryBean" />
4、打开services-config.xml,删除我们自己配置的SpringFactory
<factories>
<factory id="spring" class="com.sky.flexonspring.factories.SpringFactory" />
</factories>
现在已经由SBI帮我们处理了,不再需要我们再去关心了
5、打开remoting-config.xml文件,删除如下代码:
<destination id="guestListService">
<properties>
<factory>spring</factory>
<source>guestListService</source>
</properties>
</destination>
整合SBI后,remoting-config.XML不再需要配置了,改成在applicationContent.xml中添加如下配置:
<!-- Expose the guestListService bean for BlazeDS remoting -->
<bean id="guestService" class="org.springframework.flex.messaging.remoting.FlexRemotingServiceExporter">
<property name="messageBroker" ref="springManagedMessageBroker"/>
<property name="service" ref="guestListService"/>
</bean>
6、最后一步,修改前台Flex程序的remoteObject对象属性,使其指向spring的url,便于spring过滤转发
<mx:RemoteObject id="ro"
destination="guestService"
endpoint="http://localhost:8080/blazeds/spring/messagebroker/amf"
分享到:
相关推荐
使用flex 4.5 + Spring 3.0 + Hibernate 3.3 + Cairngorm 2.2.1 + BlazeDS 3.3.0 + Spring BlazeDS Integration 1.0.3整合出的一个登录的小demo·
Spring BlazeDS Integration,Flex通过remoteObject与java通讯,附带例子 文档
NULL 博文链接:https://madfroghe.iteye.com/blog/935337
Spring BlazeDS Integration 1.0.0
2. Flex + BlazeDS + Spring BlazeDS Integration + Spring(>= 2.5.6) + iBATIS + Cairngorm 3. Flex + BlazeDS + Spring() + iBATIS + pureMVC 4. Flex + BlazeDS + Spring BlazeDS Integration + Spring(>= ...
整合 Adobe Flex 和 Spring 的关键就在于提供一种方法使得 Adobe Flex 客户端程序可以很容易访问到 Spring...利用开源框架 BlazeDS 和 Spring BlazeDS Integration 来集成 Adobe Flex 和 Spring 可以帮助你做到这一点。
NULL 博文链接:https://chenhuiggggg.iteye.com/blog/1994009
Spring BlazeDS Integration
2. Flex + BlazeDS + Spring BlazeDS Integration + Spring(>= 2.5.6) + iBATIS + Cairngorm 3. Flex + BlazeDS + Spring() + iBATIS + pureMVC 4. Flex + BlazeDS + Spring BlazeDS Integration + Spring(>= ...
10.6 使用BlazeDS和Spring消费面向消息的服务 421 10.6.1 问题 421 10.6.2 解决方案 422 10.6.3 工作原理 422 10.7 将依赖注入带给你的ActionScript客户 434 10.7.1 问题 434 10.7.2 解决方案 434 ...
BlazeDS/Flex, AMQP/Rabbit, and many more. If “simple” means something with few parts, then Spring isn’t simple. Yet Spring does simplify Java development. As a general rule, it does so by isolating...
10.6 使用BlazeDS和Spring消费面向消息的服务 421 10.6.1 问题 421 10.6.2 解决方案 422 10.6.3 工作原理 422 10.7 将依赖注入带给你的ActionScript客户 434 10.7.1 问题 434 10.7.2 解决方案 434 ...
Flex on Java shows how to use Flex alongside existing Java applications, and how to integrate Flex using familiar server-side technologies such as Spring, EJBs, JMS, and more. The authors, both Agile...