程序中从HttpServletRequest中获取参数方法:
post请求中从form-data中获取键值对参数的如下:
Map <String, Object> map = WebUtils.getParametersStartingWith(request, "");
从request流中获取参数:
StringBuffer contentBuffer = new StringBuffer();
String line = null;
while (!StringUtils.isBlank((line = bufferedReader.readLine()))) {
contentBuffer.append(line).append(SystemUtils.LINE_SEPARATOR);//添加换行符
}
return contentBuffer.toString();
或者:
String contentStr = IOUtils.toString(request.getInputStream(), "utf-8");