Haven't used RestyGWT, but after reading thru different available options, 
I recently switched to Errai JAX-RS, the setup is pretty straight forward 
and it provides out of the box jackson serialization/de-serialization and 
cross-domain access.


On Tuesday, November 8, 2016 at 4:10:26 PM UTC-5, Velusamy Velu wrote:
>
> @Thomas Broyer
>
> Thanks for the prompt response and suggestions. I did switch to 
> GWT RequestCallback but the problem seems to larger than I expected.
>
> It appears the GWT Response class and the Jersey Response classes may not 
> be compatible.
>     @GET
>     @Produces(MediaType.APPLICATION_JSON)
>     @Path("/{id}")
>     public Response get(@PathParam("id") String id) {
> .
> .
> .
>         Response response = Response.ok(json).status(200).build();
>         return response;
>
> On the GWT client side the response.getStatusCode() is always 0 and the 
> call response.getText() returns an empty string.
>
> I'm not sure if there is a simpler solution than using RestyGWT.
>
> On Monday, November 7, 2016 at 5:53:33 PM UTC-5, Velusamy Velu wrote:
>>
>> 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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to