java读取请求中body数据
/**
* 获取request中body数据
*
* @author lifq
*
* 2017年2月24日 下午2:29:06
* @throws IOException
*/
public static String getRequestBodyData(HttpServletRequest request) throws IOException{
BufferedReader bufferReader = new BufferedReader(request.getReader());
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = bufferReader.readLine()) != null) {
sb.append(line);
}
return sb.toString();
}