radioAe6rt

GWT-Restlet snippet

leave a comment »

Rob Heittman was good enough to post this tidbit of what a RESTful call and callback look like using the Restlet API in Google Web Toolkit:


 button.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
       new Client(Protocol.HTTP).put("http://localhost:8888/demo/hello.txt", "entity", new Callback() {
          @Override
          public void onEvent(Request request, Response response) {
              try {
                 label.setText(response.getEntity().getText());
              } catch (final Exception ioException) {
                  GWT.log("Restlet I/O failed", ioException);
              }
           }
        });
     }
   });

You’d use this in conjunction with a server process that can handle RESTful requests. A bit more detail can be found here.

Written by radioae6rt

September 10, 2008 at 10:15 am

Posted in Internet

Leave a Reply