Top Description Fields Constructors Methods
org.springframework.web.servlet.theme

public Class SessionThemeResolver

extends AbstractThemeResolver
Class Inheritance
Annotations
@Deprecated
since:6.0
Imports
jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.springframework.lang.Nullable, org.springframework.util.StringUtils, org.springframework.web.util.WebUtils

Deprecated

since 6.0.

as of 6.0 in favor of using CSS, without direct replacement

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.

Authors
Jean-Pierre Pawlak, Juergen Hoeller
Since
17.06.2003
See Also
setThemeName

Field Summary

Modifier and TypeField and Description
public static final String
THEME_SESSION_ATTRIBUTE_NAME

Name of the session attribute that holds the theme name.

Inherited from org.springframework.web.servlet.theme.AbstractThemeResolver:
ORIGINAL_DEFAULT_THEME_NAME

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
resolveThemeName(HttpServletRequest
the request to be used for resolution
request
)

Implements org.springframework.web.servlet.ThemeResolver.resolveThemeName.

Resolve the current theme name via the given request.

public void
setThemeName(HttpServletRequest
the request to be used for theme name modification
request
,
HttpServletResponse
the response to be used for theme name modification
response
,
String
the new theme name (null or empty to reset it)
themeName
)

Implements org.springframework.web.servlet.ThemeResolver.setThemeName.

Set the current theme name to the given one.

Inherited from org.springframework.web.servlet.theme.AbstractThemeResolver:
getDefaultThemeNamesetDefaultThemeName

Field Detail

THEME_SESSION_ATTRIBUTE_NAMEback to summary
public static final String THEME_SESSION_ATTRIBUTE_NAME

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.

See Also
org.springframework.web.servlet.support.RequestContext#getTheme, org.springframework.web.servlet.support.RequestContextUtils#getTheme

Constructor Detail

SessionThemeResolverback to summary
public SessionThemeResolver()

Method Detail

resolveThemeNameback to summary
public String resolveThemeName(HttpServletRequest request)

Implements org.springframework.web.servlet.ThemeResolver.resolveThemeName.

Doc from org.springframework.web.servlet.ThemeResolver.resolveThemeName.

Resolve the current theme name via the given request. Should return a default theme as fallback in any case.

Parameters
request:HttpServletRequest

the request to be used for resolution

Returns:String

the current theme name

Annotations
@Override
setThemeNameback to summary
public void setThemeName(HttpServletRequest request, HttpServletResponse response, String themeName)

Implements org.springframework.web.servlet.ThemeResolver.setThemeName.

Doc from org.springframework.web.servlet.ThemeResolver.setThemeName.

Set the current theme name to the given one.

Parameters
request:HttpServletRequest

the request to be used for theme name modification

response:HttpServletResponse

the response to be used for theme name modification

themeName:String

the new theme name (null or empty to reset it)

Annotations
@Override