JsonEncoding encoding = getJsonEncoding(outputMessage.getHeaders().getContentType());
ObjectWriter writer = getWriterForView(view.getView());
JsonGenerator jsonGenerator =
writer.getFactory().createGenerator(outputMessage.getBody(), encoding);
try {
writer.writeValue(jsonGenerator, view.getData());
}
catch (IOException ex) {
throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
}
}