JavaOne 2008 - JAX-RS: The Java API for RESTful Web Services

11:35 pm Java

I attended the session “JAX-RS: The Java API for RESTful Web Services” presented by Marc Hadley and Paul Sandoz of SUN Microsystems. This session gave a brief overview of what RESTful web services are, and how they can be used with the JAX-RS API.

There are five steps of REST:

  1. Give everything an ID — this translates to a URI reference
  2. Link things together — using an XML definition
  3. Use standard methods — GET, POST, PUT, DELETE
  4. Multi-representations of data — XML, XHTML, JSON, Text
  5. Stateless communication — everything needed to make a request is contained in the request

Using REST vs SOAP has many benefits. On the server, there is horizontal scaling, simple fail over, cacheing, and reduced coupling. On the client, there is easy experimentation in the browser, bookmarking, broad language support, and a choice of data formats.

SUN’s Jersey reference implementation of the JAX-RS API uses annotations for defining RESTful web services. The @Path notation is used for defining ID’s. A link is defined with the @Context notation. The standard methods use @GET, @PUT, @POST, and @DELETE annotations. Multiple representations of the data are done using the @ProduceMime and @ConsumeMime notations

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.