文章摘要:java如何修复xss漏洞 xss漏洞解决方案java
使用Java修复xss漏洞的方法 public class XssFilter implements Filt […]
使用Java修复xss漏洞的方法
public class XssFilter implements Filter {
@Override
public void destroy() {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
//包装request
XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request);
chain.doFilter(xssRequest, response);
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
}