关于MVC:拦截器,如何设置排除路径 [英] About mvc:intercepter,how to set excluded path

查看:585
本文介绍了关于MVC:拦截器,如何设置排除路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道,我们可以像这样配置拦截器:

As we know, we can config an interceptor like that:

 <mvc:interceptor>
        <mvc:mapping path="/outfit/**" />
        <bean class="OpenSessionInViewInterceptor">
            <property name="sessionFactory">
                <ref bean="sessionFactory" />
            </property>
        </bean>

我的问题,如何配置排除的路径?

My question, how to configure excluded path?

推荐答案

我认为您不能声明.但是在拦截器中,您可以添加if(..)并验证是否应将请求uri排除在外.您可以在拦截器xml定义中将排除路径设置为列表属性.

I don't think you can declaratively. But within the interceptor you can add an if(..) and verify whether the request uri should be excluded. You can set the exclusion paths as a list property in the interceptor xml definition.

为此,您必须扩展OSIV拦截器并添加该自定义逻辑&排除列表属性.

For that you will have to extend the OSIV interceptor and add that custom logic & exclusion list property.

这篇关于关于MVC:拦截器,如何设置排除路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆