java 中Flex开发RemoteOject 配置详解

java 中Flex开发RemoteOject 配置详解

 java后台配置如下

1。在下载BlazeDS类包

2。解压将BlazeDS中flex配置文件拷贝到web-inf目录下

3。在remote-config。xml配置暴露的服务信息。

4。在修改web。xml文件配置Flex插件BlazeDS信息

5。在服务器中部署后台java项目

 在Flex前台必须配置信息

6。在将前台项目的路径指向的Flex build Path为:后项目中swf目录;

输入 Main fold:src

输入output foldD:\workspaces\apache-tomcat-6.0.18\webapps\DataService\swf

7 。在flex前台页面使用RemoteObject访问数据信息


 <mx:RemoteObject id="ro" destination="productService" endpoint="http://localhost:8090/FlexRemoteObject/messagebroker/amf" >
  <mx:method name="getProducts" result="resultHandler(event)" fault="faultHandler(event)"/>
 </mx:RemoteObject>

必须设置destination属性值暴露的服务的名称在romote-config.xml存在的destination名称

同时endpoint的属性值为:"http://ip:端口/项目上下文/messagebroker/amf表示默认的名称messagebroker/amf其中messagebroker为Web.xml配置的名称:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

    <display-name>BlazeDS</display-name>
    <description>BlazeDS Application</description>

    <!-- Http Flex Session attribute and binding listener support -->
    <listener>
        <listener-class>flex.messaging.HttpFlexSession</listener-class>
    </listener>

    <!-- MessageBroker Servlet -->
    <servlet>
        <servlet-name>MessageBrokerServlet</servlet-name>
        <display-name>MessageBrokerServlet</display-name>
        <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
        <init-param>
            <param-name>services.configuration.file</param-name>
            <param-value>/WEB-INF/flex/services-config.xml</param-value>
       </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

 

<!---服务映射名称--->

    <servlet-mapping>
        <servlet-name>MessageBrokerServlet</servlet-name>
        <url-pattern>/messagebroker/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
    </welcome-file-list>

    <!-- for WebSphere deployment, please uncomment -->
    <!--
    <resource-ref>
        <description>Flex Messaging WorkManager</description>
        <res-ref-name>wm/MessagingWorkManager</res-ref-name>
        <res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    -->

</web-app>

 

源代码如下:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值