java如何修复xss漏洞


java如何修复xss漏洞

文章插图

使用Java修复xss漏洞的方法public class XssFilter implements Filter {@Overridepublic void destroy() {}@Overridepublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {【java如何修复xss漏洞】//包装requestXssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request);chain.doFilter(xssRequest, response);}@Overridepublic void init(FilterConfig filterConfig) throws ServletException {}}

    推荐阅读