/** * @Description(获取request内容) @param request * @return */ public static String getReqMsg(HttpServletRequest request) { InputStream in=null; StringBuffer json = null; try { in = request.getInputStream(); json = new StringBuffer(); byte[] b = new byte[4096]; for (int n; (n = in.read(b)) != -1;) { json.append(new String(b, 0, n)); } String msg = json.toString(); if (msg.indexOf("text=\"") > -1) { msg = msg.substring(0, msg.indexOf("text=\"") + 5) + "\\\"" + msg.substring(msg.indexOf("text=\"") + 6, msg.indexOf("\"\"")) + "\\\"\"" + msg.substring(msg.indexOf("\"\"") + 2, msg.length()); } return msg; } catch (Exception e) { json.append(""); }finally { if(in!=null){ try { in.close(); } catch (IOException e) { e.printStackTrace(); } } } return json.toString(); }
从request获取body参数
最新推荐文章于 2024-05-28 15:36:15 发布