Results 1 to 3 of 3

Thread: Does roo generated controllers support Content Negotiation for REST?

  1. #1
    Join Date
    Aug 2009
    Posts
    3

    Default 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. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    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

  3. #3
    Join Date
    Aug 2009
    Posts
    3

    Default

    Stefan,

    Thanks for your reply, the info is very useful.

    Regards,
    Jiang Zhu

Posting Permissions

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