不能够。
但是你可以过滤器的代码里来进行筛选,
也可以把这些不需要过滤的URL
放到 FilterConfig里。
同样可以实现你的目的。
示例如下:
public voiddo
Filter(ServletRequest request, ServletResponse response, FilterChain filterChain) {
try {
request.setCharacterEncoding("GB2312");
((HttpServletResponse)response).setHeader("Pragma","No-cache");
((HttpServletResponse)response).setHeader("Cache-Control","no-cache");
((HttpServletResponse)response).setHeader("Expires","0");
if (((HttpServletRequest)request).getRequestURI().endsWith("login.do")
||((HttpServletRequest)request).getRequestURI().endsWith("logout.do")) {
filterChain.doFilter(request, response);
return;
}
//在这里进行过滤
//System.out.println("你的请求是"+((HttpServletRequest)request).getRequestURI());
filterChain.doFilter(request, response);
}
catch(ServletException sx) {
filterConfig.getServletContext().log(sx.getMessage());
}
catch(IOException iox) {
filterConfig.getServletContext().log(iox.getMessage());
}
}