验证过滤器进行权限验证的原理。
创建Filter:
package com.example.filter;import javax.servlet.*; import javax.servlet.annotation.WebFilter; import java.io.IOException;@WebFilter(urlPatterns = "/*") public class DemoFilter implements Filter {@Overridepublic void init(FilterConfig filterConfig) throws ServletException{System.out.println("init初始化方法执行了");}@Overridepublic void doFilter(ServletRequest request, ServletResponse response,FilterChain chain)throws IOException,ServletException{System.out.println("拦截到了请求");}@Overridepublic void destroy(){System.out.println("destroy销毁方法执行了");}}