layout | title |
---|---|
index |
RestyGWT |
{% assign project_version = site.project_versions.last %}
Full room for RestyGwt + Jersey presentation by David Chandler @GwtCreate 2015, amazing !
1Add RestyGWT to your classpath
Download the latest stable RestyGWT jar
Or if you are a maven user, then just add the following dependency to your pom.xml
.
{% highlight xml %} org.fusesource.{{site.project_name}} {{site.project_name}} {{project_version}} {% endhighlight %}
2Add RestyGWT to you GWT module file
{% highlight xml %}
{% endhighlight %}
3Define your REST client interface
Use JAX-RS annotations to make it even simpler !
{% highlight java %}
public interface PizzaService extends RestService {
@POST
@Path("pizzaorders")
public void order(PizzaOrder request,
MethodCallback callback);
}
{% endhighlight %}
4Use your client
{% highlight java %}
PizzaService service = GWT.create(PizzaService.class);
service.order(order, new MethodCallback() {
public void onSuccess(Method method, OrderConfirmation response) {
//code your stuff here
}
public void onFailure(Method method, Throwable exception) {
//code your stuff here
});
{% endhighlight %}
<iframe class="center" width="480" height="360" src="//www.youtube.com/embed/9o0J3yWbTKY" frameborder="0" allowfullscreen></iframe>
Want to know more ? Checkout the documentation or restygwt google group