Announcement Announcement Module
Collapse
No announcement yet.
Using JSon/Rest service Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      Hi,

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

      Regards
      Roger

      Comment

      Working...
      X