How to call custom interseptor in spring portlet?
I have added my own interceptor in spring portlet i.e.
<bean id="portletModeParameterHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping">
<property name="interceptors">
<list>
<ref bean="customInterceptor"/>
</list>
</property>
<property name="portletModeParameterMap">
...............
.......
</property>
<bean id="customInterceptor" class="com.xyz.CustomInterceptor"></bean>
开发者_运维问答And I have write CustomInterceptor class
class CustomInterceptor extends HandlerInterceptorAdapter implements ServletContextAware {
//@override
public boolean preHandleAction(ActionRequest request, ActionResponse response, Object handler) {
...............
............
}
}
This CustomInterceptor
should get call for every request before controller call.
But CustomInterceptor
not getting called by spring.
Is anything goes wrong over here?
Thank You.
I may be late for responding to you question but you need to use below code..
<bean id="customInterceptor" class="com.xyz.CustomInterceptor"></bean>
<bean class="org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="interceptors">
<list>
<ref bean="customInterceptor" />
</list>
</property>
</bean>
精彩评论