[jboss-user] [JBoss Seam] - Re: Seam remoting or DWR

Fangzx do-not-reply at jboss.com
Sun Nov 11 21:16:36 EST 2007


After two days hard work, I decided to modify remote.js in 
jboss-seam-remoting.jar to support synchronous call.

old code:

   asyncReq.open("POST", Seam.Remoting.resourcePath + path, true);  

new code :

   asyncReq.open("POST", Seam.Remoting.resourcePath + path, Seam.Remoting.async);  

I create an utility method to remoting call that can used by DWR and
JBoss Seam Remoting:

	function rmtCall(method, callback, params, isAsync) {
  | 		var s = method.split('.');
  | 		var callParams = [];
  | 		if (params) {
  | 			for (i = 0;i < params.length; i++) {
  | 				callParams.push(params);
  | 			}
  | 		}
  | 		if (Seam.serverSide) {
  | 			callParams.push(callback);
  | 			var obj = Seam.Component.newInstance(s[0]);
  | 			Seam.Remoting.async = isAsync;
  | 			eval('obj.' + s[1] + '.apply(obj, callParams)');
  | 		} else {
  | 			callParams.push( {
  | 				callback : callback,
  | 				async : isAsync
  | 			});
  | 			eval(method + '.apply(' + s[0] + ', callParams)');
  | 		}
  | 	}
  | 

Any comments are appreciated.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103530#4103530

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103530



More information about the jboss-user mailing list