public interface ThemeResolver
This interface allows for implementations based on session,
cookies, etc. The default implementation is
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 RequestContext.getTheme()
to retrieve the current theme in controllers or views, independent
of the actual resolution strategy.
Theme
,
ThemeSource
Modifier and Type | Method and Description |
---|---|
String |
resolveThemeName(HttpServletRequest request)
Resolve the current theme name via the given request.
|
void |
setThemeName(HttpServletRequest request,
HttpServletResponse response,
String themeName)
Set the current theme name to the given one.
|
String resolveThemeName(HttpServletRequest request)
request
- the request to be used for resolutionvoid setThemeName(HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable String themeName)
request
- the request to be used for theme name modificationresponse
- the response to be used for theme name modificationthemeName
- the new theme name (null
or empty to reset it)UnsupportedOperationException
- if the ThemeResolver implementation
does not support dynamic changing of the theme