Skip to content
noamt edited this page Apr 8, 2013 · 18 revisions

Introduction

grails-jaxrs is a Grails plugin that supports the development of RESTful web services based on the Java API for RESTful Web Services (JSR 311: JAX-RS). It is targeted at developers who want to structure the web service layer of an application in a JSR 311 compatible way but still want to continue to use Grails' powerful features such as GORM, automated XML and JSON marshalling, Grails services, Grails filters and so on. This plugin is an alternative to Grails' built-in mechanism for implementing RESTful web services.

At the moment, plugin users may choose between Jersey and Restlet as JAX-RS implementations. Both implementations are packaged with the plugin. Support for Restlet was added in version 0.2 of the plugin in order to support deployments to Google App Engine. Other JAX-RS implementations such as RestEasy or Apache Wink are likely to be added in upcoming versions of the plugin. Please let us know if you'd like to have them added.

Latest Releases

  • [ReleaseNotes_0_7 Release notes for grails-jaxrs version 0.7] (for Grails 2.1.x, 2.2.x coming soon)
  • [ReleaseNotes_0_6 Release notes for grails-jaxrs version 0.6] (for Grails 2.0.x)

Features

  • Makes the JSR 311 (JAX-RS) available to Grails applications for developing RESTful web services.
  • New Grails artefact types, [GettingStarted#Create_a_resource Resource] and [AdvancedFeatures#Entity_providers Provider], for JAX-RS classes.
    • JAX-RS Resource classes under grails-app/resources are auto-detected and can be modified at runtime.
    • JAX-RS Provider classes under grails-app/providers are auto-detected and can be modified at runtime.
  • Extended Grails command line interface
    • Create new resources and unit test templates via grails create-resource <resource name>.
    • Generate ready-to-use resources from domain objects via grails generate-resources <domain class name>.
  • [GettingStarted#Scaffolding Scaffolding]
    • Generate RESTful service interfaces for Grails domain objects.
    • Content negotiation support for XML and JSON representations.
  • Ability to use any Grails feature within JAX-RS resources and providers such as
    • GORM can be used [AdvancedFeatures#Using_GORM for interacting with persistent domain objects].
    • Grails filters for [AdvancedFeatures#Applying_filters intercepting requests to JAX-RS resources].
    • Grails services which can be [AdvancedFeatures#Service_injection auto-injected by name].
  • Entity providers
    • [AdvancedFeatures#Domain_objects Domain object providers] that convert between Grails domain objects and XML or JSON representations.
    • Support classes for developing [AdvancedFeatures#Custom_providers custom entity providers].
    • Support for [AdvancedFeatures#Domain_objects content negotiation] based on the Accept request header.
  • Easy [http://code.google.com/p/grails-jaxrs/wiki/AdvancedFeatures#Integration_testing integration testing] of JAX-RS resources and providers.
  • Plugin users may choose between Jersey and Restlet as JAX-RS implementations by means of [AdvancedFeatures#JAX-RS_implementation configuration].
  • grails-jaxrs applications can be [AdvancedFeatures#Google_App_Engine deployed to Google App Engine] (GAE).

#Getting started

  • If you've used an older version of grails-jaxrs take a look at the [ReleaseNotes_0_4 release notes for version 0.4]
  • Detailed installation instructions can be found on the [InstallationInstructions] page.
  • First steps with the grails-jaxrs plugin are described in the [GettingStarted] guide.
  • Advanced grails-jaxrs features are described on the [AdvancedFeatures] page.