!299 XssHttpServletRequestWrapper中增加available方法

Merge pull request !299 from Ming/master
This commit is contained in:
若依 2021-08-29 07:36:57 +00:00 committed by Gitee
commit 5ade90debf
1 changed files with 7 additions and 1 deletions

View File

@ -63,7 +63,8 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
// xss过滤
json = EscapeUtil.clean(json).trim();
final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8"));
byte[] jsonBytes = json.getBytes("utf-8");
final ByteArrayInputStream bis = new ByteArrayInputStream(jsonBytes);
return new ServletInputStream()
{
@Override
@ -78,6 +79,11 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
return true;
}
@Override
public int available() throws IOException {
return jsonBytes.length;
}
@Override
public void setReadListener(ReadListener readListener)
{