Java获取HttpServletRequest内的消息体
作者:互联网
废话不多说直接上代码
//获取请求体的输入流
InputStream inputStream = request.getInputStream();
BufferedReader reader=new BufferedReader(new InputStreamReader(inputStream));
String line;
StringBuffer buf=new StringBuffer();
while((line=reader.readLine())!=null){
buf.append(line);
}
String s = buf.toString();
s就是消息体内容了
标签:HttpServletRequest,Java,String,StringBuffer,获取,reader,new,line,buf 来源: https://blog.csdn.net/m0_48324758/article/details/122860906