• SpringMVC 拦截器


    public class LoginIntercetor implements HandlerInterceptor{
    
        @Override
        public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
            System.out.println("进入拦截器");
            return true;
        }
    
        @Override
        public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
            System.out.println("postHandler");
        }
    
        @Override
        public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
            System.out.println("处理完成");
        }
    }
    

      

        <!--配置拦截器-->
        <mvc:interceptors>
            <mvc:interceptor>
                <mvc:mapping path="/**"/>
                <bean class="com.core.LoginIntercetor"/>
                <!--那些类不进入拦截器-->
                <!--<mvc:exclude-mapping path=""></mvc:exclude-mapping>-->
            </mvc:interceptor>
            <mvc:interceptor>
                <mvc:mapping path="/**"/>
                <bean class="com.core.LoginIntercetor"/>
            </mvc:interceptor>
        </mvc:interceptors>
    

      

  • 相关阅读:
    [WP]XCTF-Reversing-Newbie_calculations
    [WP]BUUCTF-Reverse-基础题(1-12)
    [WP]XCTF-notsequence
    [WP]XCTF-easyre-153
    [WP]XCTF- 攻防世界-crypto-新手练习区
    [WP]XCTF-simple-check-100
    [WP]XCTF-SignIn
    [WP]XCTF-666
    [WP]XCTF-Reversing-x64Elf-100
    [WP]XCTF-流浪者
  • 原文地址:https://www.cnblogs.com/yanqin/p/5824185.html
Copyright © 2020-2023  润新知