Announcement Announcement Module
Collapse
No announcement yet.
RestTemplate does not work with spring mvc-ajax sample Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RestTemplate does not work with spring mvc-ajax sample

    I have had problems using RestTemplate against the spring mvc-ajax sample. My source:

    Code:
    RestTemplate rest = new RestTemplate();
    AvailabilityStatus l1 = rest.getForObject(
          "http://localhost:8080/org.springframework.samples.mvc.ajax-1.0.0-SNAPSHOT/account/availability?name={name}",
                    AvailabilityStatus.class, "X");
    The exception:

    Code:
    Exception in thread "main" org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [poc.AvailabilityStatus] and content type [application/json;charset=UTF-8]
    The problem is with the AvailabilityStatus (not having default constructor, etc) - as soon as I replaced AvailabilityStatus with my own domain object on the server and client, everything worked great. I thought I would mention the problem here just in case anyone else hit the same problem.

    I was using 3.0.2.RELEASE on both server and client.
Working...
X