xss漏洞

java如何修复xss漏洞

九三
309
2021-02-07 17:55:05
栏目: 编程语言

java如何修复xss漏洞

使用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 {

}

}

0
看了该问题的人还看了