mirror of
https://gitee.com/wkeyuan/DWSurvey.git
synced 2024-11-30 02:58:55 +08:00
解决TOMCAT高版本兼容问题
This commit is contained in:
parent
c4ec7ccef5
commit
0e868bf85f
@ -47,6 +47,13 @@ public class XssHttpWrapper extends HttpServletRequestWrapper {
|
||||
*/
|
||||
@Override
|
||||
public String getHeader(String name) {
|
||||
if("If-None-Match".equals(name)){
|
||||
// W/"14873-1619252839000"
|
||||
String value = super.getHeader(name);
|
||||
if(value==null || value.length()<50){
|
||||
return super.getHeader(name);
|
||||
}
|
||||
}
|
||||
String value = super.getHeader(xssEncode(name));
|
||||
if (value != null) {
|
||||
value = xssEncode(value);
|
||||
@ -54,8 +61,8 @@ public class XssHttpWrapper extends HttpServletRequestWrapper {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
@ -169,6 +176,7 @@ public class XssHttpWrapper extends HttpServletRequestWrapper {
|
||||
*/
|
||||
public String xssEncode(String s)
|
||||
{
|
||||
|
||||
if (s == null || s.isEmpty())
|
||||
{
|
||||
return s;
|
||||
@ -188,7 +196,6 @@ public class XssHttpWrapper extends HttpServletRequestWrapper {
|
||||
result = escape(result);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -247,4 +254,4 @@ public class XssHttpWrapper extends HttpServletRequestWrapper {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@
|
||||
</filter-mapping>
|
||||
|
||||
<!-- 配置Java Xss保护过滤器 -->
|
||||
<filter>
|
||||
<filter>
|
||||
<filter-name>xssFilter</filter-name>
|
||||
<filter-class>com.key.common.plugs.xss.XssFilter</filter-class>
|
||||
</filter>
|
||||
|
Loading…
Reference in New Issue
Block a user