It surprises none that Grails can expose REST services gracefully and effortlessly, just watch how the masters do it in
Mastering Grails: RESTful Grails. However making REST calls from within a Grails application is a task left to your own wits. Fortunately Groovy makes that task also a simple one, at least when it comes to GET, but what about POST or PUT? There are a few alternatives however:
- Cook up your own REST library leveraging Apache HTTPClient, a common component used on the Java world.
- Go one level up in the abstraction chain and use HTTBuilder, which relies on Apache HTTPClient.
- Or simply type grails install-plugin rest.
That's right, the recently announced
Griffon REST plugin has spawned a copy of itself as a
Grails plugin. Provided behavior and configuration options are pretty much identical.
On a related note, a new version of the Grails
J2D plugin has been released too. This release updates the plugin to
GfxBuilder 0.2.1 (bye bye GraphicsBuilder!).
Feedback is always appreaciated.
Keep on Groovying!