gwt Server side communication with RestyGwt Defining and using your REST client


You should already have your backend REST resource available. On the client side (GWT) your need to

  1. Add RestyGwt dependency to your project with maven

  2. Add the inheritance to your module file

    <inherits name="org.fusesource.restygwt.RestyGWT"/>
  3. Create your client interface

    public interface PizzaService extends RestService {
        public void order(PizzaOrder request, 
                          MethodCallback<OrderConfirmation> callback);
  4. Use your client where you want in you app

    PizzaService service = GWT.create(PizzaService.class);
    service.order(order, new MethodCallback<OrderConfirmation>() {
    public void onSuccess(Method method, OrderConfirmation response) {
      //code your stuff here
    public void onFailure(Method method, Throwable exception) {
      //code your stuff here