java如何修复xss漏洞

882
2021/2/7 17:55:05
栏目: 编程语言
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

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 {

}

}

辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读: dom型xss漏洞修复方式有哪些