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

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.

Author
Jean-Pierre Pawlak

Author
Juergen Hoeller

Since
17.06.2003

See Also
#setThemeName

Constructors

<init>

SessionThemeResolver()

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.

Properties

THEME_SESSION_ATTRIBUTE_NAME

static val THEME_SESSION_ATTRIBUTE_NAME: String

Name of the session attribute that holds the theme name. Only used internally by this implementation. Use RequestContext(Utils).getTheme() to retrieve the current theme in controllers or views.

Functions

resolveThemeName

open fun resolveThemeName(request: HttpServletRequest): String

setThemeName

open fun setThemeName(request: HttpServletRequest, response: HttpServletResponse, themeName: String): Unit