一、该问题的重现步骤是什么?
1. 支付成功后,需要向后台发送回调通知,格式XML,需要在request ,IO流中获取
2. 配置xss放行之后,依然为空
3.因为request流数据只能读取一次,是否在这之前系统拦截器,提前读取了IO数据流?
下面为处理请求的代码,读书数据为空
@PostMapping(value = "/payNotify")
public String payNotify(HttpServletRequest request) throws IOException {
InputStream inStream = request.getInputStream();
ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = inStream.read(buffer)) != -1) {
outSteam.write(buffer, 0, len);
}
String resultxml = new String(outSteam.toByteArray(), "utf-8");
outSteam.close();
inStream.close();
System.out.println("========================="+resultxml);
return null;
}
扫一扫访问 Blade技术社区 移动端