I have a RESTEasy service that returns a HTTP 500 when a server side error occurs. I manage to attach a body to the HTTP response in order to give more details about the error. So the response that comes out of the service looks something like this
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: application/xml;charset=ISO-8859-1
Content-Language: en-US
Content-Length: 3251
Date: Thu, 14 Oct 2010 23:22:49 GMT
Connection: close
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><myErrorEnvelope><internalCode>123</internalCode><description>error details</description></myErrorEnvelope>
I have a client (spring MVC 3.0 REST client) and I am trying to capture the HTTP 500 and read the body of the response and deserialize the myErrorEnvelope object. I first catch a catch RestClientException and it correctly tells me there was a HTTP 500 response but then there seems to be no way to get the Body of the response. Is this something I'm not supposed to be able to do? Am I supposed to return the error object as the body of a HTTP 200 response instead? I really would rather return HTTP 500 with a body.
Thanks.