annotations, finalMediaType, headerMap, firstByteActionOut);
firstByteActionOut.close();
JaxRsHandler.localRequest.remove();
} catch (Exception ex) {
try {
BodyStoringResponse responseFake = new BodyStoringResponse(response);
JaxRsHandler.handleException(ex, request, responseFake);
final MessageBody body = responseFake.getBody();
if (body != null) {
try {
//doing priviledged as this might invoke doAs to
//write the body as subject
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {