Buscar este blog

domingo, 21 de junio de 2015

Spring MVC Portlet Interceptor

How to create a interceptor in Spring MVC Portlet

<bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
 <property name="portletModeMap">
  <map>
   <entry key="view" value-ref="oneController" />
  </map>
 </property> 
 
 <property name="interceptors">
  <list>
   <ref bean="pruebaCustomInterceptor" />
  </list>
 </property>
</bean>
    
<bean id="pruebaCustomInterceptor" class="es.pruebas.portlet.cve.controller.CustomInterceptor"/>

The bean "oneController" is just a MVC Portlet controller, a class annotated with @Controller.

public class CustomInterceptor extends org.springframework.web.portlet.handler.HandlerInterceptorAdapter {

   @Override
    protected boolean preHandle(final PortletRequest request, final PortletResponse response, final Object handler) throws Exception {      
        return super.preHandle(request, response, handler);
    }
}

No hay comentarios:

Publicar un comentario