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

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

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

    posts - 32,comments - 8,trackbacks - 0
    Flash 與后臺(tái)交互方式包括了:
    1. LoadVars(xml) 實(shí)際上就是flash里面一個(gè)對(duì)象,類似一個(gè)連接器。新建之后,通過(guò)sendAndLoad獲取、設(shè)置值。和httpposter一樣
    var data_lv = new LoadVars(); 
    2. flash remoting. flash需要安裝components;后臺(tái)服務(wù)器需要OpenAMF。
    gateway_conn = NetServices.createGatewayConnection(); myService = gateway_conn.getService("myservice", this); 
    3. webservice 也是在flash里面初始化一個(gè)ws的對(duì)象,然后調(diào)用。var ws:WebService = new WebService(ws_url);
    4. XMLSocket 主要是即時(shí)通訊 var socket:XMLSocket = new XMLSocket();
    5. 直接開flash的socket
    http://androider.javaeye.com/blog/268933
    在一個(gè)AMF交互的例子中,服務(wù)器建立一個(gè)MAP對(duì)象,例如:
       HashMap map=new HashMap();  
       map.put("Event", "人物移動(dòng)");  
       map.put("user", "閃刀浪子");  
       map.put("x", 100);  
       map.put("y", 100);    
    這樣flash就可以獲取這個(gè)對(duì)象:var obj:Object=new Object();  
    posted @ 2010-06-17 14:15 張辰 閱讀(431) | 評(píng)論 (2)編輯 收藏


    1. Spring IoC容器的意義

    使用BeanFactory,根據(jù)制定的xml, 動(dòng)態(tài)生成對(duì)象然后加載。

    只要是從BeanFactory獲取的對(duì)象,都會(huì)根據(jù)xml進(jìn)行裝配。


    2. Spring MVC

    在web.xml配置了DispatcherServlet,讓所有請(qǐng)求都被這個(gè)servlet攔截。同時(shí)配置了這個(gè)servlet的初始化對(duì)象。
    。init-param = /WEB-INF/Config.xml ->
    。viewResolver::org.springframework.web.servlet.view.InternalResourceViewResolver
    。urlMapping::org.springframework.web.servlet.handler.SimpleUrlHandlerMapping

    這個(gè)urlMapping的目標(biāo),可能是被spring接管的對(duì)象,例如SimpleFormController

    當(dāng)配置了DispactcherServlet之后,通過(guò)設(shè)置合適的初始化對(duì)象,能夠?qū)崿F(xiàn)某種MVC模式。



    3. spring + blazeds 集成
    http://static.springsource.org/spring-flex/docs/1.0.x/reference/html/ch02s02.html

    在web.xml配置了2個(gè)dispatcherservlet
    。*.service === /WEB-INF/remoting-servlet.xml
    。/messagebroker/* === /WEB-INF/flex-config.xml 表示把blazeds的請(qǐng)求映射到messagebroker


    。第一個(gè)servlet繼續(xù)配置了urlMapping
    ==HessianServiceExporter可將一個(gè)普通bean導(dǎo)出成遠(yuǎn)程服務(wù) 這樣這些被映射出來(lái)的service可以通過(guò)url訪問。
    問題:這些service有固定的方法,比如execute,那么這些方法如何被調(diào)用了?代碼上看,是被command調(diào)用了。
    回答:見第二個(gè)配置

    。第二個(gè)servlet同樣配置了urlMapping;還包括
    ..MessageBrokerHandlerAdapter
    ..RemotingDestinationExporter -> callDisptacherService -> CallDispatcher -> Command.execute
    問題:那么CallDispatcher的Call是如何調(diào)用的?
    回答:在Flash的xml文件里面指定調(diào)用了。

     


    這樣故事就全部被串起來(lái)了。

    首先blazeds是個(gè)servlet,被封裝過(guò)后,能夠解析flash傳輸?shù)腶mf格式。

    通過(guò)spring的配置,flash的請(qǐng)求被轉(zhuǎn)移到了messagebroker = blazeds,同時(shí)這個(gè)messagebroker依賴了特定的bean,例如callHandler. 這些handler又依賴了service 的屬性,這個(gè)屬性就是我可以控制的,同時(shí)被flash調(diào)用的。

    例如

     



    what is web.xml :: listener 
    它能捕捉到服務(wù)器的啟動(dòng)和停止! 在啟動(dòng)和停止觸發(fā)里面的方法做相應(yīng)的操作!
    一定是httpServlet
    http://zhidao.baidu.com/question/39980900


    如何加載services-config.xml

    MessageBrokerFactoryBean將會(huì)去尋找BlazeDS的配置文件(默認(rèn)位置為/WEB-INF/flex/services-config.xml)
    posted @ 2010-06-17 09:33 張辰 閱讀(456) | 評(píng)論 (2)編輯 收藏

    本文講解一個(gè)不規(guī)范的spring quick start.

    1. 下載spring的插件包,什么版本之類的不用管了。反正能用。
    spring.jar http://www.boxcn.net/shared/yg306zac1h
    common-logging.jar http://www.boxcn.net/shared/ix93ziqljv

    2. 進(jìn)入eclipse,F(xiàn)ile - New - Java Project.
    projectname = spring001 ===> Next
    在新建導(dǎo)向的第二頁(yè),是Java Settings, 選擇Libraries -> Add External JARS -> 添加上面2個(gè)jar
    finish

    3. 進(jìn)入Package Explorer, 在src下新建一個(gè)class.
    Package = com.java114.spring.test
    Name = HelloWordSpring
    再?gòu)?fù)選框:public static void main(String[] args) 鉤上

    4. 在HelloWordSpring.java 輸入以下的代碼
    package com.java114.spring.test;

    import org.springframework.beans.factory.BeanFactory;
    import org.springframework.beans.factory.xml.XmlBeanFactory;
    import org.springframework.core.io.ClassPathResource;
    import org.springframework.core.io.Resource;

    public class HelloWordSpring
    {
        
    private String msg;

        
    public void setMsg(String msg)
        {
            
    this.msg = msg;
        }

        
    public void sayHello()
        {
            System.out.println(msg);
        }

        
    public static void main(String[] args)
        {
            Resource res 
    = new ClassPathResource("com/java114/spring/test/bean.xml");
            BeanFactory factory 
    = new XmlBeanFactory(res);
            HelloWordSpring hello 
    = (HelloWordSpring) factory.getBean("helloBean");
            hello.sayHello();
        }

    }

    5. 在和HelloWordSpring.java 相同目錄下面,再新建一個(gè)xml文件,名字是bean.xml, 內(nèi)容如下
    <?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:aop="http://www.springframework.org/schema/aop" 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/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd             http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
     
    <bean id="helloBean" class="com.java114.spring.test.HelloWordSpring">
      
    <property name="msg" value="simple spring demo"/>
     
    </bean>
    </beans>
    為什么這樣寫,我也不知道,不管他。

    6. 鼠標(biāo)右鍵選擇HelloWordSpring.java, 選擇Run As - Java Applications, 得到結(jié)果:
    2010-6-16 21:39:47 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    信息: Loading XML bean definitions from class path resource [com/java114/spring/test/bean.xml]
    simple spring demo

    posted @ 2010-06-16 20:13 張辰 閱讀(258) | 評(píng)論 (0)編輯 收藏
    比較難的一部分

    前提條件:
    axis安裝路徑 C:\ericsson\javaextend\axis-1_4
    項(xiàng)目名稱:axisdemo
    已經(jīng)有的類:com.service.myService.java
    配置文件:server-config.wsdd

    1. 在項(xiàng)目添加java2wsdl目錄

    2.目錄下面添加build.xml文件
    <?xml version="1.0" encoding="UTF-8"?>
    <project name="Generate WSDL from JavaBeans as Web Services" default="j2w-all" basedir=".">
        
    <property name="build.dir" value="../build/classes" />
        
    <property name="axis.dir" location="C:\ericsson\javaextend\axis-1_4" />
        
    <path id="classpath.id">
            
    <fileset dir="${axis.dir}/lib">
                
    <include name="*.jar" />
            
    </fileset>
            
    <pathelement location="${build.dir}" />
        
    </path>
        
    <taskdef name="axis-java2wsdl" classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask" loaderref="axis">
            
    <classpath refid="classpath.id" />
        
    </taskdef>
        
    <target name="j2w-all">
            
    <antcall target="j2w-JavaBeanWS" />
        
    </target>
        
    <target name="j2w-JavaBeanWS">
            
    <axis-java2wsdl classname="com.service.myService" classpath="${build.dir}" methods="getusername" output="myService.wsdl" location="http://localhost:8080/axisdemo/services/myService" namespace="http://localhost:8080/axisdemo/services/myService" namespaceImpl="http://localhost:8080/axisdemo/services/myService">
            
    </axis-java2wsdl>
        
    </target>
    </project>
    注意:build.dir / axis.dir / j2w-javabeanws幾個(gè)地方的內(nèi)容要修改。

    3. 右鍵點(diǎn)擊build.xml,運(yùn)行ant,就可以看到生成了myService.wsdl

    4.現(xiàn)在要把這個(gè)wsdl轉(zhuǎn)化成為java,新建目錄:wsdl2java

    5. 新建一個(gè)build.xml,內(nèi)容:
    <?xml version="1.0" encoding="UTF-8"?>
    <project name="wsclient" default="all" basedir=".">
        
    <property name="axis.home" location="C:\ericsson\javaextend\axis-1_4" />
        
    <property name="options.output" location="../wsdl2java" />
        
    <path id="axis.classpath">
            
    <fileset dir="${axis.home}/lib">
                
    <include name="**/*.jar" />
            
    </fileset>
        
    </path>
        
    <taskdef resource="axis-tasks.properties" classpathref="axis.classpath" />
        
    <target name="-WSDL2Axis" depends="init">
            
    <mkdir dir="${options.output}" />
            
    <axis-wsdl2java output="${options.output}" url="${options.WSDL-URI}" verbose="true" />
        
    </target>
        
    <target name="init">
            
    <echo>Warning: please update the associated WSDL file(s) in the folder wsdl before running the target!</echo>
            
    <echo>Warning: Just run the target(s) related with your developing work!</echo>
            
    <echo>
            
    </echo>
        
    </target>
        
    <target name="all">
            
    <antcall target="myService" />
        
    </target>
        
    <target name="myService">
            
    <antcall target="-WSDL2Axis">
                
    <param name="options.WSDL-URI" location="../java2wsdl/myService.wsdl" />
            
    </antcall>
        
    </target>
    </project>
    注意修改的地方:axis.home

    6.build ant,在wsdl2java目錄下面多出來(lái)了4個(gè)類:
    myService.java
    MyServiceService.java
    myServiceServiceLocator.java
    MyServiceSoapBindingStub.java
    全部拷貝到src目錄下面

    7.在src目錄下面添加類:
    package com.axistest;

    import localhost.axisdemo.services.myService.MyService;
    import localhost.axisdemo.services.myService.MyServiceServiceLocator;

    public class myServiceTestorByStubs
    {
        
    public static void main(String[] args) throws Exception
        {
            MyServiceServiceLocator Service 
    = new MyServiceServiceLocator();
            MyService port 
    = Service.getmyService();
            String response 
      port.getusername(鄒萍");
            System.out.println(response);
        }
    }

    8.最后運(yùn)行java application就完成了


    posted @ 2008-12-18 11:03 張辰 閱讀(391) | 評(píng)論 (0)編輯 收藏
    reference:
     part1


    1. in package explorer, change myService.java:
    package com.service;
    public class myService {
    public String getusername(String name){
            
    return "Hello "+name+",this is an Axis Web Service";
        }
    }
    and ctrl+1 to solve the package problem( or you can create dir and move file yourself)

    2.in WebContent/WEB-INF/, create server-config.wsdd
    <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
    <handler type="java:org.apache.axis.handlers.http.URLMapper" name="URLMapper"/>    
       
    <service name="myService" provider="java:RPC">
            
    <parameter name="className" value="com.service.myService"/>
            
    <parameter name="allowedMethods" value="getusername"/>
        
    </service> 
    <transport name="http">
     
    <requestFlow>
        
    <handler type="URLMapper"/>
     
    </requestFlow>
    </transport>
    </deployment>

    3. in src/, create myServiceTestorByWSDD.java
    import java.net.MalformedURLException;
    import java.rmi.RemoteException;
    import javax.xml.rpc.ServiceException;
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    public class myServiceTestorByWSDD {
    public tatic void main(String[] args) throws ServiceException,MalformedURLException, RemoteException {
            String endpoint 
    = http://localhost:8080/oopsaxis1/services/myService;
            Service service 
    = new Service();                // 創(chuàng)建一個(gè)Service實(shí)例,注意是必須的!
            Call call = (Call) service.createCall();   // 創(chuàng)建Call實(shí)例,也是必須的!
            call.setTargetEndpointAddress(new java.net.URL(endpoint));// 為Call設(shè)置服務(wù)的位置
            call.setOperationName("getusername");              // 注意方法名與JavaBeanWS.java中一樣!!
            String res = (String) call.invoke(new Object[] { "pixysoft" });       // 返回String,傳入?yún)?shù)
            System.out.println(res);
    }
    }

    4. open tomcat, and :http://localhost:8080/oopsaxis1/servlet/AxisServlet,you can see:
    And now Some Services
    myService (wsdl) 
    getusername 

    5. right click myServiceTestorByWSDD.java, run as java application.


    done!

    posted @ 2008-12-17 13:51 張辰 閱讀(271) | 評(píng)論 (0)編輯 收藏

    reference:

    http://www.cnblogs.com/cy163/archive/2008/11/28/1343516.html

    pre-condition:
    1.install eclipse
    2.install tomcat plugin

    process:
    1.download axis lib: http://ws.apache.org/axis

    2. set classpath:
    1.AXIS_HOME
    D:\Java\axis-1_4(這是我的Axis路徑)
    2.AXIS_LIB
    %AXIS_HOME%\lib
    3.AXIS_CLASSPATH
    %AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery-0.2.jar;%AXIS_LIB%\commons-logging-1.0.4.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar;%AXIS_LIB%\wsdl4j-1.5.1.jar;%AXIS_LIB%\activation.jar;%AXIS_LIB%\xmlrpc-2.0.jar
    4.CLASSPATH
    .;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar; %AXIS_CLASSPATH%;
    5.在你的%TOMCAT_HOME%\common\lib下需要加入三個(gè)包 activation.jar、mail.jar、tools.jar,注意這三個(gè)包是必須的,盡管tools.jar很常見,但這也是運(yùn)行Axis所必須的包。


    3.FIle - new - dynamic web project
    projectname: oopsaxis1
    target runtime: apache tomcat V5.5


    4. oopsaxis1/WebContent/WEB-INF/lib,add lib from %AXIS_HOME%\lib
    axis.jar/axis-ant.jar/commons-log.jar...

    5.oopsaxis1/WebContent/WEB-INF/web.xml,  replace by %AXIS_HOME%\webapps\axis\WEB-INF\web.xml

    6.oopsaxis1/src, add java file:
    public class myService
    {
        
    public String getusername(String name)
        {
            
    return "Hello " + name + ",this is an Axis DII Web Service";
        }
    }


    7.copy myService to oopsaxis1/WebContent, and rename to myService.jws

    8. right click myService.jws, run as - run on server, you can see:
    http://localhost:8080/oopsaxis1/myService.jws
    There is a Web Service here
    Click to see the WSDL 
    click the link, you can see the wsdl


    9. in eclipse - package explorer - src, new class:
    package com.oopsaxis;

    import java.net.MalformedURLException;
    import java.rmi.RemoteException;

    import javax.xml.rpc.ParameterMode;
    import javax.xml.rpc.ServiceException;

    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import org.apache.axis.encoding.XMLType;

    public class myServiceTestorByjws
    {
        
    public static void main(String[] args) throws ServiceException,
                MalformedURLException, RemoteException
        {
            String endpoint 
    = http://localhost:8080/oopsaxis1/myService.jws;
            String name 
    = " pixysoft";
            Service service 
    = new Service();
            Call call 
    = (Call) service.createCall();

            call.setTargetEndpointAddress(
    new java.net.URL(endpoint));
            call.addParameter(
    "param1", XMLType.XSD_STRING, ParameterMode.IN);
            call.setOperationName(
    "getusername");
            call.setReturnType(XMLType.XSD_STRING);
            String ret 
    = (String) call.invoke(new Object[] { name });
            System.out.println(
    "返回結(jié)果:" + ret);
        }
    }

    10. right click myServiceTestorByjws, run as java application,you get:
    返回結(jié)果:Hello pixysoft,this is an Axis DII Web Service

    done!
    posted @ 2008-12-17 13:40 張辰 閱讀(275) | 評(píng)論 (0)編輯 收藏
    主站蜘蛛池模板: 国产美女无遮挡免费视频 | 中文字幕亚洲免费无线观看日本| 全免费a级毛片免费**视频 | 免费鲁丝片一级在线观看| 亚洲国产成人资源在线软件| 国产a视频精品免费观看| 日韩毛片免费在线观看| 亚洲av永久中文无码精品综合| 免费人成视频在线| 在线aⅴ亚洲中文字幕| 日本不卡视频免费| 一区二区免费国产在线观看| 中文字幕久久亚洲一区| 精品成人免费自拍视频| 亚洲无人区视频大全| 一级毛片免费一级直接观看| 亚洲免费观看网站| 亚洲影视自拍揄拍愉拍| 日日AV拍夜夜添久久免费| 一级一级一片免费高清| 国产亚洲色婷婷久久99精品| 亚洲免费网站在线观看| 婷婷亚洲综合一区二区| 美女裸身网站免费看免费网站| 亚洲AV综合色区无码二区偷拍| 在线看片无码永久免费aⅴ | 爱情岛亚洲论坛在线观看| 久久亚洲精品无码播放| 在线观看国产一区亚洲bd| 亚洲精品麻豆av| 99久久人妻精品免费一区| 亚洲三区在线观看无套内射| 美女视频黄频a免费| 女人18毛片水最多免费观看| 久久精品国产亚洲av高清漫画| 一级视频免费观看| 久久精品国产亚洲AV无码娇色| 嫩草影院在线免费观看| 99在线免费观看| 亚洲色偷偷偷综合网| 国产亚洲精品看片在线观看|