Announcement Announcement Module
Collapse
No announcement yet.
Does roo generated controllers support Content Negotiation for REST? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Does roo generated controllers support Content Negotiation for REST?

    In my project, RESTful urls need to handle different types of response (html/txt, application/xml & application/json for my case). Does ROO generated project give this functionality already?


    Regards,
    Jiang Zhu

  • #2
    Jiang,

    What you are looking for is Springs new ContentNegotiatingViewResolver which allows you to configure the document types. It is documented here http://tinyurl.com/kpexuu and allows you to render views in XML, JSON, ATOM and a couple more.

    This feature is not currently enabled by default in Roo managed applications but can be easily added to the webmvc-config.xml file. Keep in mind when you setup JSON with the Jackson library you will need to deal with cyclic references.

    HTH,
    Stefan

    Comment


    • #3
      Stefan,

      Thanks for your reply, the info is very useful.

      Regards,
      Jiang Zhu

      Comment

      Working...
      X