/***json 格式样例* * @param response* @param jsonString*/public void responseJsonString(HttpServletResponse response, String jsonString) {response.setContentType("application/json; charset=utf-8");byte[] bytes;try {bytes = jsonString.getBytes("UTF-8");} catch (UnsupportedEncodingException e) {throw new RuntimeException(e);}response.setContentLength(bytes.length);try {OutputStream os = response.getOutputStream();os.write(bytes);os.flush();if (logger.isDebugEnabled()) {logger.debug("Send the client " + jsonString);}} catch (IOException e) {logger.error("Exception happens.", e);throw new RuntimeException(e);}finally { if (os!= null) { os.close(); } }}