首页 > 编程语言 > 详细

Spring mvc:interceptors 探究

时间:2018-08-28 14:02:34      阅读:181      评论:0      收藏:0      [点我收藏+]

使用实例:

	<mvc:interceptors>
		<mvc:interceptor>
			<mvc:mapping path="/**" />
			<mvc:exclude-mapping path="/**.html" />
			<mvc:exclude-mapping path="/assets/" />
			<bean class="com.imserver.framework.web.AuthorityInterceptor" />
		</mvc:interceptor>
		<bean class="com.imserver.framework.web.AuthorityInterceptor" />
		<ref bean="viewResolver"/>
	</mvc:interceptors>
  

  

interceptors 元素只能包含 interceptor、bean 和 ref。 bean 和 ref 指向的类需要实现 HandlerInterceptor 接口,或者继承HandlerInterceptorAdapter 类重写自己关心的某个方法。
interceptor 元素包含mapping、exclude-mapping、bean, 必须包含bean。
path 匹配:
  • 必须以 / 开头
  • ** 表示多级目录
  • * 表示任意

Spring mvc:interceptors 探究

原文:https://www.cnblogs.com/baozixiaopu/p/9547465.html

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