spring拦截器排除 静态资源

拦截器需要排除静态资源,不然会造成资源浪费

 

 

<!-- 拦截器 -->
<mvc:interceptors>  
    <!-- 使用bean定义一个Interceptor,直接定义在mvc:interceptors根下面的Interceptor将拦截所有的请求 -->  
    <mvc:interceptor>
        <mvc:mapping path="/**"/>    
        <mvc:exclude-mapping path="/resources/**"/>       
        <bean class="com.idreamsky.rainbow.report.interceptor.UrlInterceptor"/>  
    </mvc:interceptor>
</mvc:interceptors>

<!-- 静态资源的处理 -->
<!--<mvc:default-servlet-handler /> -->
<mvc:resources location="/WEB-INF/resources/**" mapping="/resources/**" cache-period="#{3600 * 24}" />

 

 

 

 

 

参考资料:

1、http://www.cnblogs.com/wxisme/p/4925331.html

posted @ 2016-11-08 11:17  xunux  阅读(1949)  评论(0编辑  收藏  举报