国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
基于blazeDS的flex4與spring的程序?qū)嵗襟E - Flex - CSDN新聞

基于blazeDS的flex4與spring的程序?qū)嵗襟E

 

Adobe Flash Builder 4 簡體中文正式版 Windows版點(diǎn)擊下載:http://g.csdn.net/5134151


Adobe Flash Builder 4 簡體中文正式版 Mac版點(diǎn)擊下載http://g.csdn.net/5134152


Adobe 在線課堂:http://adobev.csdn.net/zx/index.html

Adobe平臺(tái)技術(shù)峰會(huì)課程視頻:http://adobev.csdn.net/



環(huán)境:

    jdk1.6

    j2ee1.5

    spring2.5.6

    blazeDS3.3

    tomcat6.0

    flex4

    myeclipse8.5

    flashBuilder4




步驟:

一、 啟動(dòng)好blazeDS(即啟動(dòng)tomcat,在[tomcat]/webapps目錄下產(chǎn)生一個(gè)blazeds文件夾(三個(gè)war包產(chǎn)生一個(gè)blazeds文件夾));

     在myeclipse8.5新建一個(gè)web Project工程,工程名為webSpring;

     把此工程加入blazeDS支持(即用blazeds下的WEB-INF文件夾替換掉web工程下的WEB-INF文件夾);

     加入spring支持(把spring相關(guān)的jar包拷貝到webSpring/WebRoot/WEB-INF/lib目錄下即可)。




二、 1. 在javaWeb工程webSpring的str目錄下分別新建一下兩個(gè)包:

        cn.xuediit.myFactory、cn.xuediit.myService;

     2. 在cn.xuediit.myFctory包下新建兩個(gè)類:FlexFactoryImpl.java和SpringFactoryInstance.java

        (1). FlexFactoryImpl.java:

              package cn.xuediit.myFactory;

       import org.apache.commons.logging.Log;

              import org.apache.commons.logging.LogFactory;

       import flex.messaging.FactoryInstance;

              import flex.messaging.FlexFactory;

              import flex.messaging.config.ConfigMap;


              public class FlexFactoryImpl implements FlexFactory {

                  private Log log = LogFactory.getLog(getClass());


                  /*override interface method*/

                  public void initialize(String id, ConfigMap configMap) {

                      System.out.println("1---flex工廠實(shí)現(xiàn)類重寫的方法initialize");

                  }



                  /*override interface method*/

                  public FactoryInstance createFactoryInstance(String id, ConfigMap properties) {

                      System.out.println("2---flex工廠實(shí)現(xiàn)類重寫的方法createFactoryInstance");

                      log.info("Create FactoryInstance.");

                      SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);

                      instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));

                      return instance;

                  }



                  /*override interface method*/

                  public Object lookup(FactoryInstance instanceInfo) {

                      System.out.println("4---flex工廠實(shí)現(xiàn)類重寫的方法lookup");

                      log.info("Lookup service object.");

                      return instanceInfo.lookup();

                  }



              }




      (2).SpringFactoryInstance.java

          package cn.xuediit.myFactory;

              import org.apache.commons.logging.Log;

              import org.apache.commons.logging.LogFactory;

              import org.springframework.beans.BeansException;

              import org.springframework.beans.factory.NoSuchBeanDefinitionException;

              import org.springframework.context.ApplicationContext;

              import org.springframework.web.context.support.WebApplicationContextUtils;


              import flex.messaging.FactoryInstance;

              import flex.messaging.FlexContext;

              import flex.messaging.FlexFactory;

              import flex.messaging.config.ConfigMap;

              import flex.messaging.services.ServiceException;


              public class SpringFactoryInstance extends FactoryInstance {

                  private Log log = LogFactory.getLog(getClass());



                  SpringFactoryInstance(FlexFactory factory, String id, ConfigMap properties) {

                      super(factory, id, properties);

                  }



                  public Object lookup() {

                      System.out.println("3---spring工廠類的方法lookup");

                      ApplicationContext appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(FlexContext.getServletConfig().getServletContext());

                      String beanName = getSource();

                      try {

                          log.info("Lookup bean from Spring ApplicationContext: " + beanName);

                          return appContext.getBean(beanName);

                      } catch (NoSuchBeanDefinitionException nex) {

                          ServiceException e = new ServiceException();

                          String msg = "Spring service named '" + beanName + "' does not exist.";

                          e.setMessage(msg);

                          e.setRootCause(nex);

                          e.setDetails(msg);

                          e.setCode("Server.Processing");

                          throw e;

                      } catch (BeansException bex) {

                          ServiceException e = new ServiceException();

                          String msg = "Unable to create Spring service named '" + beanName + "'.";

                          e.setMessage(msg);

                          e.setRootCause(bex);

                          e.setDetails(msg);

                          e.setCode("Server.Processing");

                          throw e;

                      } catch (Exception ex) {

                          ServiceException e = new ServiceException();

                          String msg = "Unexpected exception when trying to create Spring service named '" + beanName + "'.";

                          e.setMessage(msg);

                          e.setRootCause(ex);

                          e.setDetails(msg);

                          e.setCode("Server.Processing");

                          throw e;

                      }

                 }



            }


    

           3. 在cn.xuediit.myService包下新建兩個(gè)類:FService.java和FServicesImpl.java

              (1). FService.java

                package cn.xuediit.myService;


                public interface FService {

                    public String sayHello(String name);

                }


              (2). FServicesImpl.java

                package cn.xuediit.myService;


                public class FServicesImpl implements FService {

                    public String sayHello(String name) {

                        System.out.println("5---服務(wù)層實(shí)現(xiàn)類(本質(zhì)上的與flex交互的類)");

                        return "我是服務(wù)層的服務(wù)實(shí)現(xiàn)類==" + name;

                    }


                }


   




三、 1、 在javaWeb工程webSpring下,在文件webSpring/WebRoot/WEB-INF/web.xml的<web-app>標(biāo)簽下添加子節(jié)點(diǎn):

          <listener>

              <listener-class>

                 org.springframework.web.context.ContextLoaderListener

              </listener-class>

          </listener>

     

      2、 在javaWeb工程webSpring下,在webSpring/WebRoot/WEB-INF目錄下新建一個(gè)文件:applicationContext.xml

        <?xml version="1.0" encoding="UTF-8"?>

        <beans xmlns="http://www.springframework.org/schema/beans"

               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

               xmlns:tx="http://www.springframework.org/schema/tx"

               xsi:schemaLocation="http://www.springframework.org/schema/beans

                                   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

                                   http://www.springframework.org/schema/tx

                                   http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

   

              <bean id="fServiceImplBeanID" class="cn.xuediit.myService.FServicesImpl"></bean>

   

        </beans>




四、 1、 在javaWeb工程webSpring下,在WebRoot/WEB-INF/flex/remoting-config.xml文件中的<service>標(biāo)簽下添加:

          <destination id="destinationID">

              <properties>

                  <factory>flexFactoryImplID</factory>

                  <source>fServiceImplBeanID</source>

                  <scope>application</scope>

              </properties>

          </destination>


     2、 在javaWeb工程webSpring下,在WebRoot/WEB-INF/flex/services-config.xml文件中的<services-config>標(biāo)簽下添加:

           <factories>

               <factory id="flexFactoryImplID" class="cn.xuediit.myFactory.FlexFactoryImpl"/>

           </factories>


五、 給此javaWeb工程添加tomcat支持,啟動(dòng)tomcat(這個(gè)容易就不說了)。


六、 在flashBuilder下新建一個(gè)基于blazeDS的flex項(xiàng)目(以webSpring為后臺(tái)工程),工程名為webFb;

     webFb.mxml:

     <?xml version="1.0" encoding="utf-8"?>

     <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

        xmlns:s="library://ns.adobe.com/flex/spark"

        xmlns:mx="library://ns.adobe.com/flex/halo"

        minWidth="500" minHeight="200">



         <fx:Script>

           <![CDATA[

              import mx.core.Application;

              import mx.rpc.events.FaultEvent;   

              import mx.collections.ArrayCollection;   

              import mx.rpc.remoting.mxml.RemoteObject;   

              import mx.controls.Alert;   

              import mx.rpc.events.ResultEvent;   

             

              public function submit(name:String):void{   

                  var remote:RemoteObject = new RemoteObject();   

                  remote.destination = "destinationID";

                  remote.endpoint = "http://localhost:8080/webSpring/messagebroker/amf";   

                  remote.addEventListener(ResultEvent.RESULT, myResult);                   

                  remote.addEventListener(FaultEvent.FAULT,fault);

                  remote.sayHello(name);     

              }   

             

              private function myResult(evt:ResultEvent):void{

                  Alert.show(evt.result.toString());   

              }   

             

              private function fault(evt:FaultEvent):void{   

                   Alert.show(evt.fault.message);   

              }          

   

           ]]>

         </fx:Script>



         <s:Button x="240" y="11" label="要發(fā)送到" click="submit(nameTxt.text)"/>

         <s:Label x="16" y="11" text="姓名"/>

         <s:TextInput id="nameTxt" x="100" y="100"/>



</s:Application>


七、 重啟tomcat,運(yùn)行flex程序,如彈出:我是服務(wù)層的服務(wù)實(shí)現(xiàn)類==(輸入框的內(nèi)容),則成功。


本文轉(zhuǎn)自:http://blog.csdn.net/luodong224/archive/2010/11/25/6036210.aspx


本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
java與flex結(jié)合做的登陸(連接數(shù)據(jù)庫) - Flex - Flash - JavaE...
集成 Flex, Spring, Hibernate 構(gòu)建應(yīng)用程序
將 Flex 集成到 Java EE 應(yīng)用程序的最佳實(shí)踐
BlazeDS入門教程
網(wǎng)絡(luò)爬蟲(網(wǎng)絡(luò)蜘蛛)之網(wǎng)頁抓取舉例說明
自定義Flume攔截器,并將收集的日志存儲(chǔ)到Kafka中(案例)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服