Coming back to a RESTful Architecture

Goodbye RequestFactory – Hello REST

After trying some days to get the RequestFactory working correctly with my spring / JPA / hibernate based backend, I finally gave up. It just wouldn’t work correctly and was honestly too complex for its purpose.

Why not RequestFactory?

There were several reasons, here a few:

  • The need of a EntityProxy class
  • The lack of good documentation
  • The problems with spring based backends
  • The need to use a proprietary protocol
  • The need of a ServiceLocator class
  • The need of a EntityLocator class
  • The problems during debugging / logging (no clear text requests)

After some tries, I just decided to skip RequestFactory. It would have been ok for my needs (only one frontend, very database driven application), but it just didn’t work as expected. I personally think, Google has to improve that some more to make it really useful.

What else can be used for Backend-Connectivity?

Since I already skipped some frameworks (gilead and others), I looked for some standard based interface utilities. Namely a REST framework.

There are (or course) several for GWT. Its always the same, no perfect solution, but instead more than enough half-good solutions 🙂


“gwt-rest-client is a simple rest request client for GWT. gwt-rest-client can send rest request which is compatible to Spring MVC.”

I just had a short look at it. It was not clear if I can use my entities directly in the interfaces adn if it would work with my jersey based backend.

Restlet edition for Google Web Toolkit

This library did lack some good examples of how to use it. It seems also not interface centric, but just offering a way of calling rest services. But I like the idea of defining my rest interface as java interfaces.


“Errai is a framework for building GWT applications”. This is a good point. Its more than just a remoting utility. It would help you build a GWT based application in multiple ways.

It honestly sounds promising, but for my purpose it was just too complicated. I will have a look at it again when I switch to an GWT application framework.


Coming to my library of choice – RestyGWT. It did exactly what I needed. You can use the same entities at client side as you use at server side. It internally uses jackson for json generation, which does jersey on my backend use also. Means that most of my “@JsonXXX” annotations are working in backen and frontend.

The only things I would like to have improved are:

  1. The need of having a REST interface definition with Callback methods. This could be easily generated from my backend interfaces with JAX-RS annotations.
  2. For entity inheritance you have to define all sub-entities in the superclass. This breaks the open closed principle. I don’t know if it could be improved and if jackson is able to do so in the backend.

But to give a summary, it works quite well.