RESTeasy

2008-03-06 @ 09:22#

been looking over the new RESTeasy library for JBoss this week. looks like there are lots of good things there. a sample the offer:

@Path("/library")
public class Library {

   @GET
   @Path("/book")
   public String getBooks() {...}

   @GET
   @Path("/book/{isbn}")
   public String getBook(@PathParm("isbn") String id) {
      // search my database and get a string representation and return it
   }

   @PUT
   @Path("/book/{isbn}")
   public void addBook(@PathParam("isbn") String id, @QueryParam("name") String name) {...}

   @DELETE
   @Path("/book/{id}")
   public void removeBook(@PathParam("id") String id {...}  
}

for my taste, this is a bit more attributes than needed. again, i like the KISS approach that uses baseclasses with just five public methods (Get(),Put(),Post(),Delete(),Options()). if you're writine HTTP apps, that's all you need. the REST[g] is icing.

also, the @ConsumeMime and @ProduceMime attributes are nice to see. support for representations must be first class in any quality REST library.

there are lots of nice things here, but one that i miss is first-class support for web caching. again, solid HTTP REST libraries need to make support for intermediaries easy and reliable.

code