我需要使用AMFChannel来连接到Flex中的RemoteObject尝试搜索很多但是无法获取源来理解传递给构造函数的两个参数...我使用spring框架作为GUI的后端使用flex创建... canm有人向我解释了flex与spring的整合,或者引导我找到合适的资源来理解它...通过它我可以理解整个场景...或者至少理解这个调用是怎样的使用消息代理。 请通过告诉我一些人帮助我,我们正在通过AMF频道构造器的意思是什么
答案 0 :(得分:0)
This link可能对某人有帮助。
MessageBroker透明地处理Flex AMF数据格式和Java之间的序列化和反序列化过程。
This link explains everything with help of example which was exactly what I was looking for
一些重要的设置信息如下
服务器端有以下文件 * testdrive / src / main / webapp / WEB-INF / spring / app-config.xml * testdrive / src / main / webapp / WEB-INF / flex-servlet.xml * testdrive / src / main / java / flex / spring / samples / product / ProductDAO.java
客户端有一个看起来像这样的文件
Step1)在flex-servlet.xml中初始化一个messagebroker
<flex:message-broker>
<flex:message-service
default-channels="my-streaming-amf,my-longpolling-amf,my-polling-amf" />
<flex:secured />
</flex:message-broker>
Step2)在同一个flex-servlet.xml中指定一个标签
<flex:remoting-destination ref="productService" />
步骤3)在app-config.xml
中<bean id="contactService" class="org.springframework.flex.samples.product.ProductDAO">
<constructor-arg ref="dataSource" />
</bean>
步骤4)ProductDAO.java是将为远程处理公开的类
客户端可以按如下方式调用远程对象
步骤5)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<!-- "productService" is defined in Spring's configuration file WEB-INF/config/web-application-config.xml
and provides remote access to the org.springframework.flex.samples.product.ProductDAO class -->
<mx:RemoteObject id="ro" destination="productService"/>
<mx:DataGrid dataProvider="{ro.findAll.lastResult}" width="100%" height="100%"/>
<!-- the findAll() method is defined in org.springframework.flex.samples.product.ProductDAO -->
<mx:Button label="Get Data" click="ro.findAll()"/>
</mx:Application>