Spring参考手册 mvc:interceptors

来源:互联网 发布:出货单打印软件免费版 编辑:程序博客网 时间:2024/06/05 22:45
 

This tag allows you to register custom HandlerInterceptors or WebRequestInterceptors that should be applied to all HandlerMapping beans.
You can also restrict the URL paths specifc interceptors apply to.
这个标签注册自定义的拦截器或请求拦截器
也可以拦截指定url路径

An example of registering an interceptor applied to all URL paths:
注册全部url到拦截器:
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptors>
An example of registering an interceptor limited to a specific URL path:
注册指定url到拦截器:
<mvc:interceptors>
<mvc:interceptor>
<mapping path="/secure/*"/>
<bean class="org.example.SecurityInterceptor" />
</mvc:interceptor>
</mvc:interceptors>

原创粉丝点击