Alex Rivera | Logout

What good open source REST webservice technology is out there?

Asked 2011-02-04T16:10:23.883
14

I'm looking for an alternative to the awesome .NET (WCF) REST capabilities.

Why?

I have deep interest in open source technology, but when it comes to webservices I do not have any experience except with .NET webservices.

Besides, I'm currently using a lot of Java and Python, and I am moving away from the Microsoft technology stack.

Please suggest alternatives in any programming language, but explain why it's good or better for some reasons. (this reason may be be tightly related with the choice of language)

What do I want to know?

  • Ease of use
    • Installation
    • Configuration
    • Generation capabilities
    • IDE integration
    • Deployment
  • Learning curve
  • Pros and cons
  • etc.
Edit
Report

1 Answer

7

Spring 3.0 REST:

Spring uses annotation based controllers, which can be used to bind a url to a method in the controller. Annotations are used to differentiate between GET methods and POST methods.

@RequestMapping(value="/hotels/{hotel}/bookings/{booking}", 
       method=RequestMethod.GET)
public String getBooking(@PathVariable("hotel") long hotelId, 
           @PathVariable("booking")     long bookingId, Model model) {

    Hotel hotel = hotelService.getHotel(hotelId);
    Booking booking = hotel.getBooking(bookingId);
    model.addAttribute("booking", booking);
    return "booking";
}

Under the hood, the variable "hotel" in the URI string is converted to a long in the parameter list, as is booking. Spring REST can also marshal JSON objects into custom classes using this same technique. Note that this method is annotated as RequestMethod.GET, which means it's invoked for GET requests but not POST requests.

Spring 3.0 REST makes it easier to create RESTful Web services by eliminating the need to reinvent the wheel or marshal/unmarshal JSON text by hand from/to Java objects.

There is a demo here on the SpringSource Blog titled REST In Spring MVC. The learning curve is low, but getting the demo to work may take some time thanks to dependencies. Once you get setup and have a working demo, the hardest part should be over.

For IDE integration, check out Spring Roo. I've not used it, but I've heard it has some features that integrate with Eclipse IDE to make your life easier.

Restlets:

Restlets were designed solely for REST. As a result, the overhead is a lot lower than Spring 3.0. Restlets are better suited for cases where you don't have a GUI, and where you aren't concerned

answered 2011-02-06T19:06:59.480

Your Answer