protected void setJsonResponse(Object bean, HttpServletResponse response) throws HttpMessageNotWritableException, IOException { MediaType jsonMimeType = MediaType.APPLICATION_JSON; if (jsonConverter.canWrite(String.class, jsonMimeType)) { jsonConverter.write(bean, jsonMimeType, new ServletServerHttpResponse(response)); } }