2008/10/30

Restlet-GWT, the compiled size

As mentioned in my previous post, I would like to check the code size generated by GWT if Restlet-GWT is used. So here are two code snippets.

The RequestBuilder from GWT core

final RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, URL
.encode("http://localhost:8080/test"));
Button b = new Button("Click me");
RootPanel.get().add(b);
b.addClickListener(new ClickListener() {

public void onClick(Widget sender) {
try {
rb.sendRequest(null, new RequestCallback() {

public void onError(Request request, Throwable exception) {

}

public void onResponseReceived(Request request,
Response response) {
RootPanel.get().add(new Label(response.getText()));
}
});
} catch (RequestException e) {
e.printStackTrace();
}
}
});


The code using Restlet-GWT

final Client client = new Client(Protocol.HTTP);

Button b = new Button("Click me");
RootPanel.get().add(b);
b.addClickListener(new ClickListener() {

public void onClick(Widget sender) {
client.get("http://localhost:8080/test", new Callback() {
public void onEvent(Request request, Response response) {
RootPanel.get().add(
new Label(response.getEntity().getText()));
}

});
}
});



The obf style code size are (not gziped):
  • For pure GWT, the size is around 30K;
  • For Restlet-GWT, the size is around 135K;
Is 100K difference big deal?

0 comments:

Footer

  © Blogger template 'Grease' by Ourblogtemplates.com 2008

Back to TOP