<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上部署B(yǎng)lazeDS和Spring程序(一)

    作者:陳省

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

    1.首先修改Flex Builder3默認(rèn)創(chuàng)建的web.xml文件。

    1.1刪除默認(rèn)的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的時(shí)候,會(huì)同時(shí)查找WEB-INF\MessageBrokerServlet- servlet.xml文件,添加WEB-INF\MessageBrokerServlet-servlet.xml文件,內(nèi)容是加載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>

    刪除默認(rèn)的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的安全認(rèn)證

    可以從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內(nèi)容為

    <?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只有一個(gè)GetUser方法,返回一個(gè)Hello Blazeds的字符串

    package com.sharpplus;

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

    創(chuàng)建Flex客戶端界面,調(diào)用我們的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
    主站蜘蛛池模板: 永久免费毛片手机版在线看| 亚洲国产成人精品无码一区二区| 伊人久久精品亚洲午夜| 亚洲网站在线免费观看| 日韩在线一区二区三区免费视频 | 日韩毛片无码永久免费看| 青青操在线免费观看| 亚洲av永久中文无码精品综合| 国产在线观看免费完整版中文版| 人妻无码久久一区二区三区免费 | 亚洲va中文字幕无码| 成人女人A级毛片免费软件| 中文字幕无码日韩专区免费| 美女免费视频一区二区| 国产成人亚洲综合网站不卡| 亚洲精品线在线观看| 狠狠亚洲婷婷综合色香五月排名 | 亚洲av无码一区二区三区网站| 免费一级特黄特色大片在线 | 女人毛片a级大学毛片免费| 日本一卡精品视频免费| 久久免费99精品国产自在现线| 亚洲heyzo专区无码综合| 亚洲av无码电影网| 亚洲美女视频免费| 91亚洲国产成人久久精品网站| 亚洲国产精品丝袜在线观看| 国产美女无遮挡免费网站| 成人激情免费视频| 免费做爰猛烈吃奶摸视频在线观看 | 国产精品亚洲精品日韩电影| 最新亚洲春色Av无码专区| 亚洲国产精品成人久久久| 久久精品国产亚洲av麻豆色欲| 国产成人精品日本亚洲| 亚洲成AV人在线观看天堂无码| 伊人亚洲综合青草青草久热| 亚洲中文字幕无码日韩| 久久久久亚洲AV综合波多野结衣| 亚洲色偷偷狠狠综合网| 午夜国产精品免费观看|