Mar 3rd, 2012, 02:39 PM
RestTemplate Client exchange expects different response body for ResponseErrorHandler
I am using RestTemplate as a Client to a server. I use RestTemplate.exchange to send the HTTP POST and indicate that I expect a specific object for the response body. However, if there is a failure on the server side, the server will respond with a response statuscode of 4xx or 5xx and will include an error object in the response body.
I cannot figure out in RestTemplate ResponseErrorHandler how to process an 4xx or 5xx error and map the response.getBody() to an expected error response object. Anyone have any ideas? Is this supported in Spring?
Mar 24th, 2012, 08:30 AM
Hi, you can see here a workaround.
Tags for this Thread