Trying to retrieve an object in my GWT client using JsonpRequestBuilder
from a cross domain server. The call goes to server and server does
respond with the correct value but the client keeps throwing "Timeout while
calling http://localhost:8080/layouts/AVhARgXQW9-o1U_GgvJa" message. Here
are the code snippets.
The call is made from this class -
public class EntityFisher {
public String fish(String id) {
JsonpRequestBuilder builder = new JsonpRequestBuilder();
String url = "http://localhost:8080/layouts/" + id;
AsyncCallback<LayoutJson> callback = new LayoutFisherCallback();
JsonpRequest<LayoutJson> layoutJson = builder.requestObject(url,
callback);
...
return t;
}
}
LayoutJson.java
public class LayoutJson extends JavaScriptObject {
protected LayoutJson() {}
public static final native LayoutJson build(String json) /*-{
return eval('(' + json + ')');
}-*/;
public final native JsonArray<PointJson> getCoordinates() /*-{
return this.coordinates;
}-*/;
}
LayoutFisherCallback.java
public class LayoutFisherCallback implements AsyncCallback<LayoutJson> {
@Override
public void onFailure(Throwable caught) {UiFlag.flag(caught);}
@Override
public void onSuccess(LayoutJson layoutJson) {
JsonArray<PointJson> pointsJson = layoutJson.getCoordinates(); //
code never reaches this point
UiFlag.flagNull("pointsJson", pointsJson);
ArrayList<Point> coordinates = new ArrayList<>();
UiFlag.flag(coordinates.toString());
}
}
the call is kicked off like this
EntityFisher fisher = new EntityFisher();
fisher.fish(id);
I see everything done correctly on the server side and the JSON
{"coordinates":[{"x":100,"y":90,"z":0,"index":0,"time":1478546404606},{"x":
118,"y":121,"z":0,"index":1,"time":1478547002023},{"x":154,"y":121,"z":0,
"index":2,"time":1478547079871}]}
is sent back as expected but I keep getting the "Timeout while calling
http://localhost:8080/layouts/AVhARgXQW9-o1U_GgvJa" on the client side.
When I make the request through GWT RequestBuilder (as a same origin
request) everything works good.
Any idea what's wrong in the above code?
I would appreciate any help.
Thanks
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.