I have a RESTEasy service that returns HTTP 500 when a server-side error occurs. I manage to bind the body to an HTTP response to give more detailed error information. So the answer that exits 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 response body and deserialize the myErrorEnvelope object. I will first catch a RestClientException and it correctly tells me that there is an HTTP 500 response, but there seems to be no way to get the Response Body. Is this something I should not do? Should I return an error object as the body of an HTTP 200 response instead? I would rather return an HTTP 500 with the body.
Thanks.
pastafarian
source share