Ejemplo n.º 1
0
 public void invoke(FilterInvocation fi) throws IOException, ServletException {
   InterceptorStatusToken token = super.beforeInvocation(fi);
   try {
     fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
   } finally {
     super.afterInvocation(token, null);
   }
 }
  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws IOException, ServletException {
    logger.debug("开始拦截器....");

    FilterInvocation fi = new FilterInvocation(request, response, chain);
    InterceptorStatusToken token = super.beforeInvocation(fi);
    try {
      fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
    } finally {
      super.afterInvocation(token, null);
    }

    logger.debug("拦截器该方法结束");
  }