From the course: Spring: Spring MVC
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Define ThemeChangeInterceptor
- Now in our application, we are going to use the CookieThemeResolver. So let's see how to utilize that. You have to go in your ApplicationConfig. So let's grab that ApplicationConfig file, let's come down there and in this, we're going to define the theme resolver Bean. So that'll be instantiated for us and I have annotated it with Bean for that purpose. So ThemeResolver and let's write inside it the actual object, the actual implementation that we need to pick up. So I'm going to instantiate CookieThemeResolver and to this CookieThemeResolver, I will set the cookie name. What this means is, we said that the CookieThemeResolver is going to pick up the name of the theme from the cookie from your browser. So how is that cookie going to be stored? How is it going to be identified? That is the name that I'm trying to configure here. So let's say it is called just theme. And another thing that we can set on this is…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Introduction to interceptors3m 28s
-
(Locked)
Built-in and custom interceptors2m 45s
-
(Locked)
Add interceptor class5m 45s
-
(Locked)
Register interceptors3m 17s
-
(Locked)
Request and session attributes1m 57s
-
(Locked)
Save and get SessionAttributes demo6m 47s
-
(Locked)
Test session flow and implement forwarding7m 37s
-
(Locked)
End HttpSession8m 33s
-
(Locked)
Redirecting outside an application3m 40s
-
(Locked)
Introduction to themes1m 48s
-
(Locked)
Define themes and theme resolver4m 18s
-
(Locked)
Define ThemeChangeInterceptor6m 38s
-
(Locked)
Pick themes on JSPs2m 37s
-
(Locked)
Introduction to l10n and i18n3m
-
(Locked)
Automatic locale resolution demo9m 55s
-
(Locked)
CookieLocaleResolver and interceptor for l10n and i18n5m 37s
-
(Locked)
-
-