Announcement Announcement Module
Collapse
No announcement yet.
PUT requests failing from RestTemplate to Roo generate JSON restful web service Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • PUT requests failing from RestTemplate to Roo generate JSON restful web service

    I've built a very simple restful JSON web service using the Roo shell that comes with STS Version: 3.0.0.201208090952-RELEASE.

    I've configured a client using the RestTemplate with a MappingJacksonHttpMessageConverter and this is working nicely for GETs, POSTs and DELETEs.

    The issue I'm hitting is with PUT operations, they do not supply a "ReponseType" to the HttpEntityRequestCallback and so default "Accept" headers are used for the the PUT request.

    Alas the MVC Web + JSON web service I built with Roo then routes the call to the HTML controller and not the JSON controller.

    As Roo is in charge of the controllers I am relying on the request mappings to "just work".
    • Should I be trying to force the RestTemplate to set "Accept: application/json" for PUTs? (If so, how?)
    • Has Roo got the controller request mapping wrong? It is currently set to "@RequestMapping(method = RequestMethod.PUT, headers = "Accept=application/json")" for the json controller.
    • Or maybe its just me that's at fault ...

    Any advice welcome!
    Thanks.

  • #2
    Just to add ... PUTs via Curl are working fine.

    Comment


    • #3
      I've solved the issue by using an alternative PUT method in the rest template which allows me to override the "accept" header by passing in an HttpEntity.

      ttfn.

      Comment


      • #4
        Can you add a JIRA issue for this as a bug in the REST support?

        Comment

        Working...
        X