O'Reilly logo

Spring MVC Cookbook by Alex Bretet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining a common WebContentInterceptor

In this recipe, we will highlight how we have implemented a WebContentInterceptor superclass for Controllers.

Getting ready

We are about to present a Controller superclass having the specificity of being registered as a WebContentInterceptor. This superclass allows us to globally control sessions and to manage caching options.

It will help us understanding the request lifecycle throughout the Framework and through other potential interceptors.

How to do it...

  1. Registering a default WebContentInterceptor with its specific configuration can be done entirely with the configuration approach:
    <mvc:interceptors> <bean id="webContentInterceptor" class="org.sfw.web.servlet.mvc.WebContentInterc eptor"> <property name="cacheSeconds" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required