• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Spring 3 and REST

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any new configuration for using REST for simplicity like annotation or spring expression language?

Rgds,
Rendi ArtaWijaya
 
author
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Spring 3.0, server-side REST features are provided by a set of annotations for your Web controllers as well as by some support for views (e.g. XML marshalling, content negociation). This is one of the most appealing feature of the REST support in Spring: it's the same programming model as Spring MVC.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Arnaud Cogoluegnes wrote:In Spring 3.0, server-side REST features are provided by a set of annotations for your Web controllers as well as by some support for views (e.g. XML marshalling, content negociation). This is one of the most appealing feature of the REST support in Spring: it's the same programming model as Spring MVC.



And in most cases, you don't have to change your Controller class/code that you are using in a web site.

Mark
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Spring 3 REST model is pretty much the same as the Spring 2.5 non-REST MVC. The key new things in Spring 3 to support REST in Spring MVC are:

- A new @PathVariable annotation for handling requests with URLs that have parameters embedded in the path (e.g., "/customer/23112/history", where 23112 is the customer's ID).
- A new ContentNegotiatingViewResolver that resolves views based on the request's file extension, HTTP Accepts header, or a parameter. For example if the request is for "/customer/23112/history", perhaps it would produce HTML output by default. But if the Accepts header says "text/xml", then maybe it would produce XML output...or if the URL were "/customer/23112/history.json", maybe it would produce JSON output.

That said, I've found that I write my controllers differently now than I did before. Previously, I wrote use-case-oriented controllers...one controller per use case...AddProductController for example. Now I find myself writing resource-oriented controllers...one controller per resource type and many handler methods...ProductController, for example. You don't have to do that, but I find it to be a much better approach.
 
Rendi Artha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Craig,
Thanks for valuable info about Spring 3 REST ...
Its good to know there are several new features, one of them are a new view resolver "ContentNegotiatingViewResolver" ... cant wait to try it.
In my thinking i could use ajax support for REST by using these new viewresolver and produce JSON to supplied by client side and hoopla..... i have ajax enable REST
Hope it works

Rgds,
Rendi
 
reply
    Bookmark Topic Watch Topic
  • New Topic