This is a single archived entry from Stefan Tilkov’s blog. For more up-to-date content, check out my author page at INNOQ, which has more information about me and also contains a list of published talks, podcasts, and articles. Or you can check out the full archive.

JAOO 2008: Arjen Poutsma on RESTful Web services with Spring

Stefan Tilkov,

These are my unedited notes from Arjen Poutsma's very good talk at JAOO.

  • REST intro (using very nice Airport pictures)
  • pointer to
  • The fact that PUT can be used to create resources in addition to updating them is one of the major differences between HTTP and CRUD
  • "Representations as reflection of resources on the cave wall" ... where have I heard this before? ;-)
  • Example for usefulness of stateless communication: Google results in the form of pages, state not kept on the server, but in the representations sent to the client [Note to self: Paging is an excellent example.]
  • OrderManagement and CustomerManagement example [pictures by me ;-)]
  • Next up: REST in Java
  • servlets handle OPTIONS correctly (?)
  • spring mvc - classic mvc has limited multi-method handling, Spring @MVC (2.5) improves this
  • servlets can be wired up within Spring just like a controller
  • Struts 2 has a REST plugin
  • Restlet is pretty good in his opinion
  • Restlet creates abstraction over HTTP, has Spring support
  • JAX-RS - annotation-based REST framework, considered pretty cool
  • JAX-RS example
  • client side: has proxy issues and surprises
  • commons HTTP client - powerful, but very verbose
  • REST + Spring
  • @Controller annotation for classes, get picked up automagically
  • URI template support for @RequestMapping method annotation
  • automatic conversion of content of specific types to Java objects and back
  • view resolution based on accept header
  • Formats: XML based on Spring-WS OXM (abstraction over mapping layers), JSON, Atom, RSS, Flex
  • Shallow ETag support w/ a very simple ServletFilter
  • RestTemplate as core client-side component, similar to other templates (Jdbc, Jms, WS)
  • getForObject - performs GET and converts
  • postForLocation - performs POST and retrieves location header
  • put, delete
  • uri = "{id}"; HotelList result = template.getForObject(uri, HotelList.class, "1")
  • will be part of Spring 3.0, PathParam in M1 (Oct), REST follows later
  • 3.0 final planned for early 2009
  • Spring security nicely integrated with HTTP authentication