【问题标题】:understanding AMFChannel in flex and message broker了解 flex 和消息代理中的 AMFChannel
【发布时间】:2011-10-21 09:21:26
【问题描述】:

我需要使用 AMFChannel 来连接到 flex 中的 RemoteObject 尝试了很多搜索但无法获取源代码来理解传递给构造函数的两个参数...我使用 spring 框架作为我的 GUI 的后端使用 flex 创建 .... 有人可以向我解释 flex 与 spring 的这种集成,或者指导我找到适当的资源来理解它......通过它我可以理解整体场景......或者至少了解这个调用是如何进行的使用消息代理制作。 请有人帮助我,告诉我我们传递给 AMF 通道构造器的 URL 的含义是什么

【问题讨论】:

    标签: apache-flex spring integration


    【解决方案1】:

    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 是为远程处理公开的类

    客户端可以如下调用远程对象

    第五步)

    <?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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-24
      • 2013-05-30
      • 1970-01-01
      • 2019-12-12
      • 2018-10-08
      • 2020-03-02
      • 2011-02-21
      • 2015-08-20
      相关资源
      最近更新 更多