tags:

views:

1307

answers:

3

I'm writing my first Groovy API for a RESTful web service. Could someone please provide some good open-source examples or best-practices to inspire my API design?

I'm considering using Groovy's Expandos, XML Parsing, and straight-forward URL request mechanism, but I'd like to hear other ways to make an API Groovy. Ideas?

Thanks a bunch.

+2  A: 

HTTP Builder for Groovy has a nice restclient and makes calling REST based services clean and easy:

http://groovy.codehaus.org/modules/http-builder/doc/rest.html

If you need to produce rather than consume a REST service, I'd recommend looking at Grails:

http://grails.org/doc/1.1/guide/13.%20Web%20Services.html#13.1%20REST

John

John Wagenleitner
A: 

I've been very happy building RESTful web services with Groovy and Restlet. I even wrote a few posts on this on my company blog: Part One, Part Two.

Avi Flax
A: 

A few months back we were also writing a RESTful service using Groovy. We had a look at Restlet, Grails and Jersey.

Jersey won the plea thanks to the cleanness of the resulting code and its problemless(1) integration with Groovy.

A short primer on Jersey + Groovy can be found Chad Gallemore's Blog.

(1) The only difference between using Jersey from Java or from Groovy is that Java uses {} and Groovy uses [] around multiple parameters for an annotation. @Produces(["application/xml", "text/xml"])

Ruben