I'm exposing my application via RESTEasy 3.0.5Final with Jackson JSON
provider. The serialization is still being written, so sometimes bugs
creep out. Most often it is some exception being thrown by the Jackson

However, at the moment it happens, the response is already commited,
status code set to 200 and partial response is being written to the
output. This is Very Bad Thing, as from the client perspective the 200
status code means everything went OK, but the JSON is broken.

For example, if the Jackson can't serialize field "abc", the resulting
JSON looks like:

> {
>   // some fields serialized correctly by Jackson, like:
>   "ok_field": 1,
>   // ...
>   // and then the erronous one, the name without a value:
>   "abc"}

This is because of the setStatus() call being in ServerResponseWriter in
line 70:

>       response.setStatus(jaxrsResponse.getStatus());

while the serialization (and an exception throw) being in line 99:

>       writerContext.proceed();

Is there any way I can defer committing anything in the response until
the whole response body is prepared?


Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
Resteasy-users mailing list

Reply via email to