开发者

understanding AMFChannel in flex and message broker

开发者 https://www.devze.com 2023-03-26 13:06 出处:网络
I need to use AMFChannel in order to connect to RemoteObject in flex tried searching a lot but couldn;t get source to understand the two parameters being passed to the constructor ... I am using sprin

I need to use AMFChannel in order to connect to RemoteObject in flex tried searching a lot but couldn;t get source to understand the two parameters being passed to the constructor ... I am using spring framework as a backend for my GUI created using flex .... canm some one explain me this integration of flex with spring or guide me to a proper resource to understand it... through which I can understand the overall scenerio... or atleast understand how t开发者_JAVA技巧his call is being made using message broker . PLEASE SOME ONE HELP ME BY TELLING ME WHAT IS THE MEANING OF URL WE ARE PASSING TO THE AMF CHANNEL CONSTRUCTOR


This link might help some one.

The MessageBroker transparently handles the process of serialization and deserialization between the Flex AMF data format and Java.

This link explains everything with help of example which was exactly what I was looking for

some important setup information is as follows

Server side has following files * 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

Client side has one file which looks like this

Step1) Initialize a messagebroker in flex-servlet.xml

<flex:message-broker>
        <flex:message-service
            default-channels="my-streaming-amf,my-longpolling-amf,my-polling-amf" />
        <flex:secured />
</flex:message-broker>

Step2) In the same flex-servlet.xml specify one tag

<flex:remoting-destination ref="productService" />

Step 3) In app-config.xml

<bean id="contactService" class="org.springframework.flex.samples.product.ProductDAO">
        <constructor-arg ref="dataSource" />
</bean>  

Step 4) ProductDAO.java is the class which will exposed for the remoting

Client side can call the remote object as follows

Step 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>
0

精彩评论

暂无评论...
验证码 换一张
取 消