<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 495,comments - 227,trackbacks - 0
    http://blog.sharpplus.com/content/%E5%9C%A8google-appegine%E4%B8%8A%E9%83%A8%E7%BD%B2blazeds%E5%92%8Cspring%E7%A8%8B%E5%BA%8F

    在Google appegine上部署BlazeDS和Spring程序(一)

    作者:陳省

    首先參考http://ria.dzone.com/articles/introduction-spring- blazeds?page=0,2這篇文章,這里我們使用Spring Blazeds Integration包來替代SpringFactory的解決方案來實現Spring和BlazeDS的集成.

    1.首先修改Flex Builder3默認創建的web.xml文件。

    1.1刪除默認的MessageBroker Servlet

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

    換成Spring的DispatcherServlet
        <!-- MessageBroker Servlet -->
        <servlet>
            <servlet-name>MessageBrokerServlet</servlet-name>
            <display-name>MessageBrokerServlet</display-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>

    注意,Spring加載MessageBrokerServlet的時候,會同時查找WEB-INF\MessageBrokerServlet- servlet.xml文件,添加WEB-INF\MessageBrokerServlet-servlet.xml文件,內容是加載spring的 xsd

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    </beans>

    刪除默認的Flex Listener和上下文配置

        <context-param>
            <param-name>flex.class.path</param-name>
            <param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
        </context-param>

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

    換成Spring的上下文和Spring用Filter

        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                /WEB-INF/config/web-application-config.xml
                /WEB-INF/config/web-application-security.xml
            </param-value>
        </context-param>
       
        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>

        <filter-mapping>
          <filter-name>springSecurityFilterChain</filter-name>
          <url-pattern>/*</url-pattern>
        </filter-mapping>
       
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>

    1.2集成Spring的安全認證

    可以從http://coenraets.org/blog/2009/05/new-test-drive-for-spring- blazeds-integration-rc1/下載Spring Blazeds TestDrive集成包,查考里面的WEB-INF\config\web-application-security.xml文件
     

    1.3開放Spring Bean提供給Flex Remoting使用,修改testdrive的WEB-INF\config\web-application-config.xml內容為

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:flex="http://www.springframework.org/schema/flex" xmlns:security="http://www.springframework.org/schema/security"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/flex
            http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
            http://www.springframework.org/schema/security
            http://www.springframework.org/schema/security/spring-security-2.0.4.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-2.5.xsd">

     
        <flex:message-broker/>

        <bean id="UserService" class="com.sharpplus.UserService" >
        </bean>

        <!-- Expose the productDAO bean for BlazeDS remoting -->
        <flex:remoting-destination ref="UserService" />
    </beans>
     

    UserService Bean只有一個GetUser方法,返回一個Hello Blazeds的字符串

    package com.sharpplus;

    public class UserService {
        public String getUser(){
            return "Hello Blazeds";
        }
    }

    創建Flex客戶端界面,調用我們的UserService,顯示字符串信息

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
            <![CDATA[
                import mx.rpc.events.ResultEvent;
                import mx.controls.Alert;
               
                private function onClick():void{
                    ro.getUser.addEventListener(ResultEvent.RESULT, onResult);
                    ro.getUser();
                }
               
                private function onResult(event:ResultEvent):void{
                    var s:String=event.result as String;
                    Alert.show(s);
                }
            ]]>
        </mx:Script>
        <mx:Button x="257" y="193" label="Hello BlazeDS"  click="onClick()"/>
        <mx:RemoteObject id="ro" destination="UserService">
           
        </mx:RemoteObject>
       
    </mx:Application>
     

    JDBC for Google appengine

    http://www.jiql.org/



    posted on 2011-02-25 15:56 SIMONE 閱讀(661) 評論(0)  編輯  收藏 所屬分類: flash
    主站蜘蛛池模板: 永久免费不卡在线观看黄网站| 欧美在线看片A免费观看| 久久亚洲日韩看片无码| 毛片免费观看网址| 亚洲精品视频免费| 亚洲图片中文字幕| 亚洲成a人片在线观看日本麻豆 | 免费A级毛片无码A∨中文字幕下载| 亚洲国产日韩在线人成下载| 免费一级毛片在线播放不收费| 一级成人a毛片免费播放| 亚洲AV无码专区亚洲AV桃| 午夜影视日本亚洲欧洲精品一区| 免费黄色小视频网站| 久操视频在线免费观看| 亚洲AV无码成人网站在线观看| 亚洲精品成人av在线| 亚洲XX00视频| www.999精品视频观看免费| 中文在线观看国语高清免费| 亚洲狠狠婷婷综合久久蜜芽| 99ri精品国产亚洲| 亚洲小说区图片区另类春色| 免费毛片网站在线观看| **毛片免费观看久久精品| 久久久久女教师免费一区| 亚洲欧美日韩国产精品一区| 中文字幕亚洲免费无线观看日本| 亚洲精品无码永久在线观看| 成全高清视频免费观看| 毛片免费全部播放无码| 中文字幕久无码免费久久| 男男gvh肉在线观看免费| 久久亚洲精品国产亚洲老地址| 亚洲国产一区二区a毛片| 亚洲色婷婷综合开心网| 国产大片51精品免费观看| 欧洲精品成人免费视频在线观看| 色欲国产麻豆一精品一AV一免费| 国产伦精品一区二区免费| 免费精品久久久久久中文字幕|