GWT JsonpRequestBuilder Timeout issue

Posted by Anthony Kong on Stack Overflow See other posts from Stack Overflow or by Anthony Kong
Published on 2010-03-08T20:09:08Z Indexed on 2010/03/08 22:21 UTC
Read the original article Hit count: 555

Filed under:
|

I am getting time out from using JsonpRequestBuilder.

The entry point code goes like this:

// private static final String SERVER_URL = "http://localhost:8094/data/view/";
private static final String SERVER_URL = "http://www.google.com/calendar/feeds/[email protected]/public/full?alt=json-in-script&callback=insertAgenda&orderby=starttime&max-results=15&singleevents=true&sortorder=ascending&futureevents=true";
private static final String SERVER_ERROR = "An error occurred while "
        + "attempting to contact the server. Please check your network "
        + "connection and try again.";

/**
 * This is the entry point method.
 */
public void onModuleLoad() {

    JsonpRequestBuilder requestBuilder = new JsonpRequestBuilder();
    // requestBuilder.setTimeout(10000);
    requestBuilder.requestObject(SERVER_URL, new Jazz10RequestCallback());

}

class Jazz10RequestCallback implements AsyncCallback<Article> {


    @Override
    public void onFailure(Throwable caught) {
        Window.alert("Failed to send the message: " + caught.getMessage());     
    }

    @Override
    public void onSuccess(Article result) {
        // TODO Auto-generated method stub
        Window.alert(result.toString());
    }

The article class is simply:

import com.google.gwt.core.client.JavaScriptObject;

public class Article extends JavaScriptObject {


    protected Article() {};


}

The gwt page, however, always hit the onFailure() callback and show this alert:

Failed to send the message. Timeout while calling <url>.

Fail to see anything on the Eclipse plugin console. I tried the url and it works perfectly.

Would appreciate any tip on debugging technique or suggestion

© Stack Overflow or respective owner

Related posts about gwt

Related posts about JSON