portletmvc4spring icon indicating copy to clipboard operation
portletmvc4spring copied to clipboard

Spring Interceptors are not being invoked with PortletMVC4Spring

Open ahujadipak3 opened this issue 5 years ago • 1 comments

Hi @ngriffin7a and Team,

I am trying to implement basic authentication using Spring REST with Liferay 7 (portletmvc4spring) where I have extended the Spring interceptor HandlerInterceptorAdapter and provided in main application context xml as follows:

<mvc:interceptors> <mvc:interceptor> <!-- <mvc:mapping path="/user/authenticate"/> --> <mvc:mapping path="/test/**"/> <mvc:mapping path="/ping/**"/> <mvc:mapping path="/secured/**"/> <mvc:mapping path="/**"/> <bean class="portlet1.interceptor.SecureRequestHandlerInterceptor"></bean> </mvc:interceptor> </mvc:interceptors>

However, the interceptor is not being invoked. I am attaching the sample project for the same. Can you please help with this this.

com.liferay.test.portletmvc4spring.portlet.zip

Thanks in advance. -Dipak Ahuja

ahujadipak3 avatar Jul 31 '20 10:07 ahujadipak3

Hello, try to add <mvc:annotation-driven />in portlet-application-context.xml, it should do the trick. Without it, many Spring MVC features won't work.

genmllc avatar Aug 12 '20 19:08 genmllc