java读取请求中body数据

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();
}
上一篇:Java使用POI读取Word中的表格


下一篇:“FAIL - Deployed application at context path but context failed to start”错误的解决