public class CookieThemeResolver extends CookieGenerator implements ThemeResolver
Custom controllers can thus override the user's theme by calling
setThemeName
, e.g. responding to a certain theme change request.
setThemeName(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_COOKIE_NAME |
static String |
ORIGINAL_DEFAULT_THEME_NAME |
static String |
THEME_REQUEST_ATTRIBUTE_NAME
Name of the request attribute that holds the theme name.
|
DEFAULT_COOKIE_MAX_AGE, DEFAULT_COOKIE_PATH, logger
Constructor and Description |
---|
CookieThemeResolver() |
Modifier and Type | Method and Description |
---|---|
String |
getDefaultThemeName()
Return the name of the default theme.
|
String |
resolveThemeName(HttpServletRequest request)
Resolve the current theme name via the given request.
|
void |
setDefaultThemeName(String defaultThemeName)
Set the name of the default theme.
|
void |
setThemeName(HttpServletRequest request,
HttpServletResponse response,
String themeName)
Set the current theme name to the given one.
|
addCookie, createCookie, getCookieDomain, getCookieMaxAge, getCookieName, getCookiePath, isCookieHttpOnly, isCookieSecure, removeCookie, setCookieDomain, setCookieHttpOnly, setCookieMaxAge, setCookieName, setCookiePath, setCookieSecure
public static final String ORIGINAL_DEFAULT_THEME_NAME
public static final String THEME_REQUEST_ATTRIBUTE_NAME
RequestContext.getTheme()
public static final String DEFAULT_COOKIE_NAME
public void setDefaultThemeName(String defaultThemeName)
public String getDefaultThemeName()
public String resolveThemeName(HttpServletRequest request)
ThemeResolver
resolveThemeName
in interface ThemeResolver
request
- request to be used for resolutionpublic void setThemeName(HttpServletRequest request, HttpServletResponse response, String themeName)
ThemeResolver
setThemeName
in interface ThemeResolver
request
- request to be used for theme name modificationresponse
- response to be used for theme name modificationthemeName
- the new theme name