spring-framework / org.springframework.web.servlet.theme

Package org.springframework.web.servlet.theme

Types

CookieThemeResolver

open class CookieThemeResolver : CookieGenerator, ThemeResolver

ThemeResolver implementation that uses a cookie sent back to the user in case of a custom setting, with a fallback to the default theme. This is particularly useful for stateless applications without user sessions.

Custom controllers can thus override the user's theme by calling setThemeName, e.g. responding to a certain theme change request.

FixedThemeResolver

open class FixedThemeResolver : AbstractThemeResolver

org.springframework.web.servlet.ThemeResolver implementation that simply uses a fixed theme. The fixed name can be defined via the "defaultThemeName" property; out of the box, it is "theme".

Note: Does not support setThemeName, as the fixed theme cannot be changed.

SessionThemeResolver

open class SessionThemeResolver : AbstractThemeResolver

org.springframework.web.servlet.ThemeResolver implementation that uses a theme attribute in the user's session in case of a custom setting, with a fallback to the default theme. This is most appropriate if the application needs user sessions anyway.

Custom controllers can override the user's theme by calling setThemeName, e.g. responding to a theme change request.

ThemeChangeInterceptor

open class ThemeChangeInterceptor : HandlerInterceptorAdapter

Interceptor that allows for changing the current theme on every request, via a configurable request parameter (default parameter name: "theme").