I’m trying to create simple urlMapping, but it doesn’t work. It goes into constructor, but don’t go into preHandle() or postHandle(). Here is xml part:
<bean id="handlerMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/*">loginFilterSpring</prop>
</props>
</property>
</bean>
<bean id="loginFilterSpring" class="com.spacebattle.filters.LoginFilterSpring"/>
What I’m doing wrong?
UPD:
I created controller, but its method handleRequestInternal() never been called. Any ideas?
<bean id="handlerMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
<ref bean="loginFilterSpring"/>
</list>
</property>
<property name="mappings">
<value>
/*=loginFilterController
</value>
</property>
</bean>
<bean id="loginFilterSpring" class="com.spacebattle.filters.LoginFilterSpring"/>
<bean id="loginFilterController" class="com.spacebattle.filters.LoginFilterController"/>
The
mappingsproperty ofSimpleUrlHandlerMappingis for your controllers. You seem to be supplying it with aHandlerInterceptor, which it will just ignore.You should specify interceptors in the
interceptorsproperty, not themappingsproperty. You then need to put a proper controller into themappingsproperty.