zoukankan      html  css  js  c++  java
  • springmvc拦截器

    1拦截器类

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
    
    public class DBInterceptor extends HandlerInterceptorAdapter {
    
        @Override
        public boolean preHandle(HttpServletRequest req, HttpServletResponse response, Object handler) throws Exception {
            
            return true;
        }
    
        @Override
        public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
                ModelAndView modelAndView) throws Exception {
        }
    
        @Override
        public void afterCompletion(HttpServletRequest req, HttpServletResponse response, Object handler, Exception ex)
                throws Exception {
        }
    
        @Override
        public void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler)
                throws Exception {
        }
    
    }
    View Code

    2xml

        <!-- com.standsoft.controller.*.* -->
        <mvc:interceptors>
            <mvc:interceptor>
                <mvc:mapping path="/**" />
                
            <mvc:exclude-mapping path="/**/fonts/*"/>
            <mvc:exclude-mapping path="/**/*.css"/>
            <mvc:exclude-mapping path="/**/*.js"/>
            <mvc:exclude-mapping path="/**/*.png"/>
            <mvc:exclude-mapping path="/**/*.gif"/>
            <mvc:exclude-mapping path="/**/*.jpg"/>
            <mvc:exclude-mapping path="/**/*.jpeg"/>
          <!--   <mvc:exclude-mapping path="/**/*login*"/>
            <mvc:exclude-mapping path="/**/*Login*"/> -->
            <!-- 定义拦截器类 -->
                <bean class="com.standsoft.interceptor.DBInterceptor"></bean>
            </mvc:interceptor>
        </mvc:interceptors>
    View Code

     

  • 相关阅读:
    搭建vue的开发环境
    笔墨录历程
    LockBit病毒oracle数据库恢复xifenfei
    Exception [type: SIGSEGV, Address not mapped to object] [] [ kgegpa()+36]
    ORA00603 ORA01092 ORA600 kcbzib_kcrsds_1
    frm和ibd文件数据库恢复惜分飞
    校验代码为 6054 坏块故障修复
    pip常用命令
    我是pear。
    Visual Studio 2008 Shell Isolated Mode(独立/隔离模式)
  • 原文地址:https://www.cnblogs.com/yanan7890/p/8681566.html
Copyright © 2011-2022 走看看