HATEOAS

56 views
Skip to first unread message

Eric Stein

unread,
Nov 7, 2017, 1:48:20 PM11/7/17
to RestyGWT
So, I'm trying to add HATEOAS support to my application, which is currently using RestService interfaces. What I've got right now looks something like:

public <T> void invoke(final String url, final Class<T> responseType, final MethodCallback<T> callback) {
   
new Resource(url).get().send(new CallbackWrapper(callback));
}

private static final class CallbackWrapper implements JsonCallback {
   
public void onFailure(...) { ... }
   
public void onSuccess(final Method method, final JSONValue response) {
       
this.callback.onSuccess(method, ????);
   
}
}

RestyGwt must have some facility for turning a JSON response into a specific response type, because it does that for all the generated RestService implementations. Is the only way to get at them really to implement an interface, as described in the docs (https://resty-gwt.github.io/documentation/restygwt-user-guide.html#json-encoderdecoders)? With a large number of possible response types in my application, I'd strongly like to avoid having to hand-write an interface and keep them in sync with my response types.

Hopefully I'm barking up the wrong tree here, and somebody can point me in a better direction.

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages