Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About mvc:intercepter,how to set excluded path

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?

like image 496
Hailei Zhang Avatar asked Apr 22 '11 06:04

Hailei Zhang


1 Answers

Since Spring 3.2 they added that feature.

See this example from the Spring documentation:

<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
<mvc:interceptor>
    <mapping path="/**"/>
    <exclude-mapping path="/admin/**"/>
    <bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor" />
</mvc:interceptor>
<mvc:interceptor>
    <mapping path="/secure/*"/>
    <bean class="org.example.SecurityInterceptor" />
</mvc:interceptor>

Here's the link to the doc

like image 58
gamerkore Avatar answered Oct 16 '22 07:10

gamerkore