February 10, 2010
It is a very common practice to develop web applications that are use-case-oriented. This approach has a very procedural feel to it where URLs often involve imperative verbs: "showProduct," "deleteOrder," or "updateShoppingCart." While this approach has served us well, it does lead to unnatural and difficult–to–follow URL schemes. Furthermore, the direct objects of the URLs' verbs are often specified in parameters, precluding any effective caching or indexing within search engines.
In contrast, RESTful web applications tend to be more resource–oriented. Rather than focus on verbs, REST places emphasis on the nouns. RESTful URLs tend to describe the target of an operation, and rely on a fixed set of verbs (GET, PUT, DELETE, and POST) to indicate the operation itself. Moreoever, RESTful URLs identify resources, which themselves may be represented in many forms. This means that if properly applied, REST can be used not only to create a web application, but to also define an API that can be used to access resources that are represented as JSON, Atom, RSS, XML, and/or (of course) HTML.
With the recent release of Spring 3.0, the Spring MVC web framework affords many opportunities for building RESTful applications. This includes a new set of annotations to support defining resource–oriented URLs, and a new REST client template for consuming RESTful APIs.
In this session, we'll look at the latest features of Spring 3.0's MVC framework, with an emphasis on building RESTful web applications. You'll see how Spring 3.0's new @PathVariable annotation can be used to develop controllers that respond to resource–oriented RESTful URLs, and how ContentNegotiatingViewResolver can turn a user–facing web application into a powerful web–based API. We'll explore other ways Spring 3.0 supports working with REST, including how to write REST clients.
The slides from Feb 10th are on SlideShare here. And the Roo project is here.