Top Description Methods
org.springframework.web.servlet

public Interface ThemeResolver

Known Direct Implementers
org.springframework.web.servlet.theme.AbstractThemeResolver, org.springframework.web.servlet.theme.CookieThemeResolver
Annotations
@Deprecated
since:6.0
Imports
jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.springframework.lang.Nullable

Deprecated

since 6.0.

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

Interface for web-based theme resolution strategies that allows for both theme resolution via the request and theme modification via request and response.

This interface allows for implementations based on session, cookies, etc. The default implementation is org.springframework.web.servlet.theme.FixedThemeResolver, simply using a configured default theme.

Note that this resolver is only responsible for determining the current theme name. The Theme instance for the resolved theme name gets looked up by DispatcherServlet via the respective ThemeSource, i.e. the current WebApplicationContext.

Use org.springframework.web.servlet.support.RequestContext#getTheme() to retrieve the current theme in controllers or views, independent of the actual resolution strategy.

Authors
Jean-Pierre Pawlak, Juergen Hoeller
Since
17.06.2003
See Also
org.springframework.ui.context.Theme, org.springframework.ui.context.ThemeSource

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the current theme name
resolveThemeName
(HttpServletRequest
the request to be used for resolution
request
)

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
)

Set the current theme name to the given one.

Method Detail

resolveThemeNameback to summary
public String resolveThemeName(HttpServletRequest request)

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

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

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)

Exceptions
UnsupportedOperationException:
if the ThemeResolver implementation does not support dynamic changing of the theme