Flex和BlazeDS用了很久,一直会出现各种稀奇古怪的问题,是时候要把源码看看了,先从BlazeDS开始。第一步从git上下载源码,搭建运行环境。然后写一个简单的测试类:
public class Hello { public String sayHello(String name) { System.out.println("hello " + name); return "hello " + name; } }
再将这个类配置起来,确保能被外部访问,有两种配置方式,第一种方式
<destination id="testService" channels="my-amf"> <properties> <source>com.lang.remote.Hello</source> </properties> </destination>
<bean id="testService" class="com.lang.remote.Hello"> <flex:remoting-destination/> </bean>
目前看来这两种方式是等价的,我本人比较喜欢第二种方式。messagebroker的配置
<flex:message-broker> <flex:mapping pattern="messagebroker/*"/> <flex:message-service default-channels="my-streaming-amf,my-longpolling-amf,my-polling-amf" /> </flex:message-broker>
配置完成,启动项目,再写一个测试类
@Test public void test() { AMFConnection conn = new AMFConnection(); try { conn.connect("http://localhost:9900/remote/messagebroker/amf"); //call里面的第一个参数是刚刚配置好的remotedistination的id,"点"后面是方法名,再后面的是参数 conn.call("testService.sayHello", "Lang"); } catch (Exception e) { fail(e.getMessage()); } }
测试环境搭建完成,接下来看看请求是怎样转发到messagebroker的
相关推荐
blazeds-bin-3.3.0.22497.zip
blazeds, flex 于 JAVA 交互插件
blazeds-core-3.2.0.3978.jar blazeds-core-3.2.0.3978.jar
blazeds-turnkey-4.0.0.14931
blazeds-turnkey-4.0.0.14931第四卷(共四卷) 含tomcat
通过使用RemoteObject控件可以轻松实现,而不需要配置他们像SOAP-compliant网络服务。 blazeds-bin-4.0.0.15974.zip
blazeds-turnkey-4.0.0.14931 FLEX学习必备的东西。
好不容易在网上找到的 flex与java通讯 工具 希望能够帮助刚学习flex节省点时间
Flex blazeds-spring Flex blazeds-spring Flex blazeds-spring Flex blazeds-spring Flex blazeds-spring Flex blazeds-spring
包含blazeds-common-4.0.0.14931.jar、blazeds-core-4.0.0.14931.jar、blazeds-proxy-4.0.0.14931.jar、blazeds-remoting-4.0.0.14931.jar
blazeds-turnkey-4.0.0.14931.zip Flex与JavaEE交互用的一个项目.用于Flex远程访问JavaEE服务器! 里面有实例和帮助文档,希望对您有用!
blazeds-turnkey-4.0.0.14931.zip分卷二
flex开发 blazeds-turnkey
Spring和Adobe Flex的开发技术文档。
blazeds-turnkeyblazeds-turnkeyblazeds-turnkeyblazeds-turnkey
blazeds-turnkey-4.0.0.14931含tomcat 第一卷(共四卷)
blazeds-turnkey-4.0.0.14931含tomcat 第二卷(共四卷)
blazeds-turnkey-4.0.0.14931第三卷(共四卷) 含tomcat
blazeds-bin-3.3.0.20776,Flex与java通信包,只要把blazeds.war发布到Tomcat的webRoot下即可。相关例子,网上有许多,配置比较简单。