GWT and Rest : Part 2 - Client (RestyGWT) 03 Jul 2013
I have written a new article with all the needed info for Jersey 2.7, you probably should have a look here
This article is part 2 of a previous post, see part1 GWT and Rest : Part 1 - Server Side (Jersey JAX-RS) for the server side information. I know it has taken me a long time to write this part. I am really sorry if you were waiting.
This part will be focused on the GWT client part, using RestyGWT
This part will be really short because there is not much say as RestyGWT make things really easy ! By the way thanks for the people who have written and contributed to this library : chirino and mkristian and all others.
The first thing you have to do is the inherits the resty stuff in your *.gwt.xml file
Thanks to this line, when extending the RestService Interface, the restyGWT generator will be able to generate the Java code corresponding to your interface.
Generators allow the GWT compiler to generate Java code at compile time and have it then be compiled along with the rest of the project into JavaScript. GWT generators behave a little bit like annotation preprocessors in Java.
To generate the client Java code, restyGWT is using the JAX-RS annotations to define the url of the request, the parameters to set etc. The code generated by RestyGWT will use com.google.gwt.http.client.Request class to query the server.
So all you have to do is extending the RestService interface and using the right JAX-RS annotations