Reputation: 5867
I want an interceptor to be called for all the url's with pattern /user/display/* and don't want to configure the controller name to which these url's map to.
Spring documentation gives the following example
<bean id="handlerMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
<ref bean="officeHoursInterceptor"/>
</list>
</property>
<property name="mappings">
<value>
/user/display/*=editAccountFormController
</value>
</property>
</bean>
In my case i don't want to give editAccountFormController. Is it possible to do that?
Upvotes: 1
Views: 864
Reputation: 403501
You can specify interceptors independently of the controllers using <mvc:interceptors>
, e.g.
<mvc:interceptors>
<mvc:interceptor>
<mapping path="/user/display/*"/>
<bean class="com.x.y.MyInterceptor" />
</mvc:interceptor>
</mvc:interceptors>
See docs for more detail.
Upvotes: 4