|
||||||||||
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(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
Field Summary | |
---|---|
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. |
Fields inherited from class org.springframework.web.util.CookieGenerator |
---|
DEFAULT_COOKIE_MAX_AGE, DEFAULT_COOKIE_PATH, logger |
Constructor Summary | |
---|---|
CookieThemeResolver()
|
Method Summary | |
---|---|
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. |
Methods inherited from class org.springframework.web.util.CookieGenerator |
---|
addCookie, createCookie, getCookieDomain, getCookieMaxAge, getCookieName, getCookiePath, removeCookie, setCookieDomain, setCookieMaxAge, setCookieName, setCookiePath |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public CookieThemeResolver()
Method Detail |
---|
public void setDefaultThemeName(String defaultThemeName)
public String getDefaultThemeName()
public String resolveThemeName(HttpServletRequest request)
ThemeResolver
resolveThemeName
in interface ThemeResolver
request
- request to be used for resolution
public 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |