Hi! I'm trying to use AutoBean framework to transfer data from server
to GWT App. GWT-RPC is not good for me, because i need to cache
responces.
So I'm trying to use JsonpRequestBuilder to fetch data and AutoBean
framework for encoding/decoding.

The simple (and not working) aproach is like this:
----  servlet's doGet() method ---
String json = AutoBeanCodex.encode(data).getPayload();
String callback = request.getParameter("callback");
PrintWriter out = response.getWriter();
try {
        out.write(callback);
        out.write("(");
        out.write(json);
        out.write(");");
} finally {
        out.close();
}

--- client ---
JsonpRequestBuilder jrb; // = ...
jrb.requestString(url, new AsyncCallback<String>(){
        public void onSuccess(String result) {
                AutoBean<DataType> bean = AutoBeanCodex.decode(factory,
DataType.class, result);
                DataType data = bean.as();
                //....
        }
        public void onFailure(Throwable caught) {
        }
});
-----
Unfortunately, this does not work, because returned data is not
actualy a String, it's a JavaScript object.

I've tried to escape json on the server to make it String:
---
out.write(callback);
out.write("(\"");
out.write(escape(json));
out.write("\");");
---
This works, but in my case it increases responce size from 700kb to
3Mb which is really not good.

Any ideas what to with this?

-- 
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-toolkit@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