Why dont just use the RequestBuilder  and send  the response back as JSON or
XML ?

2010/7/11 Joe Cole <profilercorporat...@gmail.com>

> We have a very large app that uses air extensively (both online and
> offline modes). We had to jump through many hoops to get RPC working.
>
> For AIR compiles, we replace the following class with this method:
>
> public final class ClientSerializationStreamReader extends
> AbstractSerializationStreamReader {
>
>        private static native JavaScriptObject eval(String encoded) /*-{
>           return $wnd.parseGwtRpc(encoded);
>         }-*/;
>
> ... etc
>
> }
>
> Air is unable to eval gwt returned responses over a certain length, as
> they are turned into arrays on the server. So we decode them if they
> are this type...
>
> // in your js file which is included...
> String.prototype.endsWith = function (s) { return this.length >=
> s.length && this.substr(this.length - s.length) == s; }
>
> function decodeGWT(s) {
>    if( ! s.endsWith("])") ) return s;
>    var end = s.indexOf("].concat(");
>    var first = s.substring(0, end+1);
>    var second = s.substring(end+"].concat(".length);
>    var arr = eval(first);
>    var middle = second.indexOf("],[");
>    var current = 0;
>    while( middle != -1 ) {
>       var x = second.substring(current, middle+1);
>       var arr2 = eval(x);
>       arr = arr.concat(arr2);
>       current = middle + 2;
>       middle = second.indexOf("],[", middle+1);
>    }
>    var y = second.substring(current, second.length-1);
>    var arr3 = eval(y);
>    return arr.concat(arr3);
> }
>
> function parseGwtRpc(encoded){
>        return eval(decodeGWT(encoded));
> }
>
> If you need any help feel free to email me.
>
> Joe
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to