private void mobileWrite() { StringBuffer sb = new StringBuffer(); sb.append("{\""); sb.append("success\":").append(action.isIsSuccessful()).append(","); sb.append("\"code\":").append(action.getStatusCode()).append(","); sb.append("\"desc\":\"").append(action.getDescription()).append("\","); sb.append("\"userid\":").append(action.getUserId()).append(","); sb.append("\"data\":") .append(new JSONActionWrite(action.getFields()).mobileWrite(action, true)); sb.append("}"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/plain"); try { PrintWriter out = response.getWriter(); out.write(sb.toString()); out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); } }