Hessian 另一个高效的flex rpc组件

[url]http://hessian.caucho.com/ria/ [/url]
package c2s 

{ 

 

    import flash.events.IOErrorEvent; 

     

    import hessian.client.HessianAsyncToken; 

    import hessian.client.HessianProxy; 

    import hessian.events.HessianErrorEvent; 

    import hessian.events.HessianResultEvent;  

     

    public class HessianServiceInvoker {  

        

       protected var resultCallbackFunction : Function;             

        protected var errorCallbackFunction : Function;   

        

       private var proxy:HessianProxy = new HessianProxy(“http://gcc.cuscstar.com:8080/hessian/service.do”); 

        

       public function HessianServiceInvoker(resultCallback:Function, errorCallback:Function) {     

            resultCallbackFunction = resultCallback;      

            errorCallbackFunction = errorCallback;     

            super();     

        }     

        

        public function resultCallback(data:Object):void {         

            resultCallbackFunction(data);     

        }     

         

        public function errorCallback(data:Object):void {         

        }  

 

       public function getWeather2(city: String):void 

       { 

         var token:HessianAsyncToken = proxy.getWeather2(city); 

         token.addEventListener(HessianErrorEvent.HESSIAN_ERROR, errorCallback); 

         token.addEventListener(HessianResultEvent.HESSIAN_RESULT, resultCallback); 

       } 

    } 

}


你可能感兴趣的:(Flex,gcc,Flash)