Package org.zkoss.web.theme
Interface ThemeResolver
public interface ThemeResolver
Interface for web-based theme resolution strategies that allows for both
theme resolution via the request and theme selection via request and response.
This interface allows for implementations based on session, cookies, etc. The default
implementation is CookieThemeResolver, which uses cookie for theme resolution and
selection.
Note that this resolver is only responsible for determining the current theme name.
The Theme instance for the resolved theme name must be looked up via ThemeRegistry
interface. For example, the user could call ThemeFns.getThemeRegistry() to obtain
the current theme registry, and then call themeRegistry.getTheme(themeName) to
retrieve the corresponding Theme instance, if a theme with such name is previously
registered.
- Since:
- 6.5.2
- Author:
- neillee
-
Method Summary
Modifier and TypeMethodDescriptiongetTheme(jakarta.servlet.http.HttpServletRequest request) Resolve the current intended theme name via the given request.voidsetTheme(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String themeName) Set the current intended theme name to the given one.
-
Method Details
-
getTheme
Resolve the current intended theme name via the given request. Whether this theme name will actually be used is subject to the theme validation and fall-back strategies.- Parameters:
request- request to be used for resolution- Returns:
- the current intended theme name
-
setTheme
void setTheme(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String themeName) Set the current intended theme name to the given one.- Parameters:
request- request to be used for theme name selectionresponse- response to be used for theme name selectionthemeName- the new intended theme name
-