获取post请求数据工具类
package com.ccidit.features.otherFunctions.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; public class CommonUtil { /** * 获取post请求BODY内容 * @param request */ public static String getPostParameter(HttpServletRequest request){ String acceptjson = ""; try { BufferedReader br = new BufferedReader(new InputStreamReader( (ServletInputStream) request.getInputStream(), "utf-8")); StringBuffer sb = new StringBuffer(""); String temp; while ((temp = br.readLine()) != null) { sb.append(temp); } br.close(); acceptjson = sb.toString(); } catch (Exception e) { e.printStackTrace(); } return acceptjson; } }