我在调用JsonpRequestBuilder
请求时遇到超时异常。
我也是参考问题,但我每次都收到超时异常。
我的入口点类是
package com.dips.restcalls.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.jsonp.client.JsonpRequestBuilder;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class RequestClass implements EntryPoint {
@Override
public void onModuleLoad() {
// TODO Auto-generated method stub
private static final String JSON_URL = "http://www.flickr.com/services/rest/?method=flickr.test.echo&format=json&api_key=XXXXXXXXXXX";
JsonpRequestBuilder builder = new JsonpRequestBuilder();
builder.setTimeout(1000);
builder.setCallbackParam("jsonCallback");
builder.requestObject(JSON_URL, new AsyncCallback<T>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
System.out.println("Fails...."+ caught);
}
@Override
public void onSuccess(T result) {
// TODO Auto-generated method stub
System.out.println("Sucess...");
}
});
}
}
我的 JavaScriptObject 类是
package com.dips.restcalls.client;
import com.google.gwt.core.client.JavaScriptObject;
public class T extends JavaScriptObject {
public T() {
// TODO Auto-generated constructor stub
}
}
在 Firebug 中,我得到 json 响应,但是在控制台中,我每次都得到 Timeout Exception。请帮我。