I'm attempting to perform JSONP (cross domain ajax), just like in this great
article (thanks)
http://eggsylife.co.uk/2010/04/22/gwt-2-jsonp-and-javascript-overlays-with-jsonprequestbuilder/

The json response has optional attributes, it could be...

    {error: "yay"}

or

    {response: 53}

The optional attributes are causing my JavaScript Overlay's + JSNI grief...
If I get don't get  {error: "yay"} and I invoke getResponse()....

    public final native int getResponse()/*-{
    return this.response;
    }-*/;

it throws...

com.google.gwt.dev.shell.HostedModeException: Something other than a double
was returned from JSNI method '@com.acme.client.Blah::getResponse()': JS
value of type undefined, expected int

Summary + Questions....
1. The JSONP response is doing nothing wrong - it's is perfectly valid
response. Some attributes are optional and Overlays seem to deals with them
poorly.
2. According to the GWT doco,  these HostedModeException only occur in Dev
mode, and never thrown in production mode. So what happens when running in
Production Mode?
3. Are there alternatives to wrapping the JSNI+JSON objects? Can I do
something in JSNI that will handle the undefined attribute happily?

Advice welcome, thanks for reading :)

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

Reply via email to