throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
try {
// TODO Need to infer media type
messageBodyWriter.writeTo(entity, entity.getClass(),
entity.getClass(), new Annotation[0],
MediaType.APPLICATION_JSON_TYPE, clientRequest.getHeaders(), baos);
} catch (IOException e) {
throw new WebApplicationException(Response.Status.BAD_REQUEST);
}