| | |
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.enums.HttpMethod;
|
| | |
|
| | | /**
|
| | | * 防止XSS攻击的过滤器
|
| | |
| | | String tempExcludes = filterConfig.getInitParameter("excludes");
|
| | | if (StringUtils.isNotEmpty(tempExcludes))
|
| | | {
|
| | | String[] url = tempExcludes.split(",");
|
| | | for (int i = 0; url != null && i < url.length; i++)
|
| | | String[] urls = tempExcludes.split(",");
|
| | | for (String url : urls)
|
| | | {
|
| | | excludes.add(url[i]);
|
| | | excludes.add(url);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | String url = request.getServletPath();
|
| | | String method = request.getMethod();
|
| | | // GET DELETE 不过滤
|
| | | if (method == null || method.matches("GET") || method.matches("DELETE"))
|
| | | if (method == null || HttpMethod.GET.matches(method) || HttpMethod.DELETE.matches(method))
|
| | | {
|
| | | return true;
|
| | | }
|