Saturday, June 15, 2013

JAX-RS 2 Starter Project

I've been experimenting with new features in JAX-RS 2, The Java API for RESTful Web Services. In doing so, I have created a jaxrs2-starter-kit project to help others quickly get up and running. It is available for download at GitHub by issuing the following command:

git clone https://github.com/jchart-github/jaxrs2-starter-kit.git

It contains sample client and server that is easily built and run using Maven.

The project demonstrates:
  • The new Client API
  • Request/Response
  • The Invocation Object and the Command Pattern
  • Build-in Entity Resolvers for Object Unmarshalling
  • Server Resource
  • Server Filter
  • Spring Integration
  • Content Negotiation with using default Entity Resolvers 

Browse the jaxrs2-starter-kit

The starter kits implements a /books resource.
It uses the following rules in its RESTFul implementation:

For collections

Resource /books
@POST create a new book
@GET list all books
@PUT bulk update books
@DELETE delete all books


For single resources

Resources /books/{id}
@POST Error
@GET return a book
@PUT if exists, update book; if not ERROR
@DELETE delete a book