|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.web.util.CookieGenerator
org.springframework.web.servlet.theme.CookieThemeResolver
public class CookieThemeResolver
Implementation of ThemeResolver that uses a cookie sent back to the user in case of a custom setting, with a fallback to the default theme. This is particularly useful for stateless applications without user sessions.
Custom controllers can thus override the user's theme by calling
setThemeName
, e.g. responding to a certain theme change request.
setThemeName(HttpServletRequest, HttpServletResponse, java.lang.String)
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_COOKIE_NAME
|
private java.lang.String |
defaultThemeName
|
static java.lang.String |
ORIGINAL_DEFAULT_THEME_NAME
|
static java.lang.String |
THEME_REQUEST_ATTRIBUTE_NAME
Name of the request attribute that holds the theme name. |
Fields inherited from class org.springframework.web.util.CookieGenerator |
---|
DEFAULT_COOKIE_MAX_AGE, DEFAULT_COOKIE_PATH, logger |
Constructor Summary | |
---|---|
CookieThemeResolver()
|
Method Summary | |
---|---|
java.lang.String |
getDefaultThemeName()
Return the name of the default theme. |
java.lang.String |
resolveThemeName(HttpServletRequest request)
Resolve the current theme name via the given request. |
void |
setDefaultThemeName(java.lang.String defaultThemeName)
Set the name of the default theme. |
void |
setThemeName(HttpServletRequest request,
HttpServletResponse response,
java.lang.String themeName)
Set the current theme name to the given one. |
Methods inherited from class org.springframework.web.util.CookieGenerator |
---|
addCookie, createCookie, getCookieDomain, getCookieMaxAge, getCookieName, getCookiePath, isCookieSecure, removeCookie, setCookieDomain, setCookieMaxAge, setCookieName, setCookiePath, setCookieSecure |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ORIGINAL_DEFAULT_THEME_NAME
public static final java.lang.String THEME_REQUEST_ATTRIBUTE_NAME
RequestContext.getTheme()
public static final java.lang.String DEFAULT_COOKIE_NAME
private java.lang.String defaultThemeName
Constructor Detail |
---|
public CookieThemeResolver()
Method Detail |
---|
public void setDefaultThemeName(java.lang.String defaultThemeName)
public java.lang.String getDefaultThemeName()
public java.lang.String resolveThemeName(HttpServletRequest request)
ThemeResolver
resolveThemeName
in interface ThemeResolver
request
- request to be used for resolution
public void setThemeName(HttpServletRequest request, HttpServletResponse response, java.lang.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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |