Results 1 to 3 of 3

Thread: Using JSon/Rest service

  1. #1

    Default Using JSon/Rest service

    Is the support for the creation of JSon/Rest services limited to Spring MVC or can it be used with a JSF project ?

    Regards
    Roger

  2. #2
    Join Date
    Jun 2008
    Location
    Philadelphia, PA, USA
    Posts
    212

    Default

    Spring MVC has support for REST via the @ResponseBody, @RequestBody, @RequestMapping and other annotations. So, using those, you'd have to be running Spring MVC.

    You could use a JAX-RS-compliant library as well, like RESTlet, instead of this support.

    One thing Spring MVC provides is the converter framework, allowing a view resolver to intercept the response generation, determine what the client wanted (via the request Accepts: header, path, or extension, and then delegate to a converter to convert that response model to XML, JSON etc...

    So, if you give that up, you'll have to do the conversions yourself and/or use a REST API from the Spring services layer and perhaps mount a separate servlet (not terribly hard, especially if you're using a JSON library directly) or do them in a JSF-compliant way. Does JSF have anything that emits raw content in JSON, XML, etc?

    One last angle - you can use JSF for the view technology from Spring Web Flow, and Web Flow rides atop Spring MVC. So there is a possibility that you could provide controllers that emit RESTful calls, and web flows that use JSF views to provide your JSF user interface layer.

    Ken
    Ken Rimple
    Chariot Solutions
    email: krimple@chariotsolutions.com
    work: www.chariotsolutions.com/education
    personal: www.rimple.com

    Author: Spring Roo in Action (Manning)
    MEAP Site: manning.com/rimple

  3. #3

    Default

    Hi,

    thanks for your help. I tried jersey and it is working so far.

    Regards
    Roger

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •