Sunday, November 25, 2012

Re: JsonpRequestBuilder requestString() - does it work?


On Monday, November 26, 2012 4:18:05 AM UTC+1, markww wrote:
Hi,

I've got an example of JsonpRequestBuilder.send() working - but this requires us to provide an overlay type in the callback:

    new AsyncCallback<MyOverlayType>() {
        public void onSuccess(MyOverlayType result) {
        }
    }

Is there a way to instead get the raw String result from the remote server, before it gets translated into a JSON object?

No.
The server sends back JavaScript that gets executed in the browser. There's no JSON in JSON-P, it's a JS object literal passed as argument to a JS function.
 
Something like:

    new AsyncCallback<String>() {
        public void onSuccess(String result) {
            println("Raw response from remote server is: " + result);
        }
    }

I thought maybe:

    JsonpRequestBuilder.requestString();

might do that, but doesn't seem to.

requestString() is for cases when the server responds with "callback('the string')"

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

No comments:

Post a Comment