首页 > 编程语言 > 详细

spring拦截器排除 静态资源

时间:2016-11-08 11:27:31      阅读:239      评论:0      收藏:0      [点我收藏+]

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

 

 

<!-- 拦截器 -->
<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

spring拦截器排除 静态资源

原文:http://www.cnblogs.com/xunux/p/6042265.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!