Excelsior Goes Open Source

Please do not worry, we are not open sourcing Excelsior JET as the last act of goodwill before shutting down the company. Excelsior is alive and kicking and our main product remains fully supported closed source. But, as you may or may not know, we also provide consulting services, including custom application development in Java and C++. When working on one such project that involved Spring MVC, a colleague of mine came up with an idea for reducing the amount of boilerplate code in functional tests. His idea then transformed into what has become our first open source project: Restler.

Meet Restler

Restler is a small library that uses annotations to help you automatically generate clients for web services, like this:

  // create service
  Service service = 
    new ServiceBuilder("http://localhost:8080").build();
  // create remote REST controller proxy
  UserController userControllerProxy =
    service.produceClient(UserController.class); 
  // execute a REST request
  userControllerProxy.login(login, pass);

Here UserController is a Spring REST Controller class, and userControllerProxy is an instance of a proxy class automatically generated by Restler. Methods of that class make HTTP requests to the REST service located at the URL passed to the ServiceBulder constructor.

If you are familiar with Square’s Retrofit, Restler works on pretty much the same principles, but with one substantial difference: it gathers information from existing Spring annotations, whereas Retrofit relies on the presence of its own annotations. The Restler approach is both an advantage — you do not need to modify the code of your server or mock its interfaces, and a limitation — it only works with Spring MVC at the moment. So right now we are making Restler extendable with plugins adding support for arbitrary annotations, and plan to create such plugins for Java EE and Spring Data REST annotations in the near future.

The source code is on GitHub, and the binaries are already published on Maven Central. See the wiki for details on how to get started.

Just one more thing: if you try Restler, please let us know what you think about it. You can reach the authors by emailing restler@excelsior-usa.com or by tweeting @restlerorg.

Categories: News, Open Source

Tags: , , ,

|