• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

spring in action -rest

 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.manning.com/walls4/excerpt_contents.html

Here the toc says there is a section - writing resource oriented contollers. why do we need this when we have jax-rs classes ?
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pradeep bhatt wrote:why do we need this when we have jax-rs classes ?



I don't suppose you necessarily *need* it. In fact, Spring MVC's REST model isn't dramatically different than JAX-RS. But one thing I can do with Spring MVC that I don't think I can do with JAX-RS (correct me if I'm wrong) is develop a website that serves resources, regardless of what representation the client wants them. What I mean by that is that I can write a Spring MVC controller that serves a Product resource (for instance) and it will be served as XML to clients asking for XML, as JSON to clients asking for JSON and as HTML/PDF/etc to clients (such as web browsers) asking for those formats on behalf of their human users. Same resource...same controller...same everything, except that the proper representation is chosen based on what the client asks for. I'm sure JAX-RS can do something along those lines, but I'm not sure about the human aspect of it (again, correct me if I'm wrong).

Also, even though the programming models are quite similar, I find comfort in knowing that my web development skills that I gained while developing human-facing websites with Spring MVC carry over to developing machine-facing web resources.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Craig.

I found this link where JAX-RS Resource class can server the format based on the input accept headers.
http://publib.boulder.ibm.com/infocenter/wasinfo/beta/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Ftwbs_jaxrs_contentnegotiation.html

Let me know if I got you wrong.

I have read your books Spring in Action -1 and Xdoclet in Action and found them to be excellent. Please keep up good work. Hope to read your new edition on Spring soon.
 
reply
    Bookmark Topic Watch Topic
  • New Topic