类 CookieThemeResolver
- java.lang.Object
- org.springframework.web.util.CookieGenerator
- org.springframework.web.servlet.theme.CookieThemeResolver
- 所有已实现的接口:
ThemeResolver
public class CookieThemeResolver extends CookieGenerator implements ThemeResolver
ThemeResolver
implementation 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.- 从以下版本开始:
- 17.06.2003
- 作者:
- Jean-Pierre Pawlak, Juergen Hoeller
- 另请参阅:
setThemeName(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
字段概要
字段 修饰符和类型 字段 说明 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.从类继承的字段 org.springframework.web.util.CookieGenerator
DEFAULT_COOKIE_PATH, logger
构造器概要
构造器 构造器 说明 CookieThemeResolver()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 org.springframework.web.util.CookieGenerator
addCookie, createCookie, getCookieDomain, getCookieMaxAge, getCookieName, getCookiePath, isCookieHttpOnly, isCookieSecure, removeCookie, setCookieDomain, setCookieHttpOnly, setCookieMaxAge, setCookieName, setCookiePath, setCookieSecure
字段详细资料
ORIGINAL_DEFAULT_THEME_NAME
public static final String ORIGINAL_DEFAULT_THEME_NAME
- 另请参阅:
- 常量字段值
THEME_REQUEST_ATTRIBUTE_NAME
public static final String THEME_REQUEST_ATTRIBUTE_NAME
Name of the request attribute that holds the theme name. Only used for overriding a cookie value if the theme has been changed in the course of the current request! Use RequestContext.getTheme() to retrieve the current theme in controllers or views.
DEFAULT_COOKIE_NAME
public static final String DEFAULT_COOKIE_NAME
构造器详细资料
CookieThemeResolver
public CookieThemeResolver()
方法详细资料
setDefaultThemeName
public void setDefaultThemeName(String defaultThemeName)
Set the name of the default theme.
getDefaultThemeName
public String getDefaultThemeName()
Return the name of the default theme.
resolveThemeName
public String resolveThemeName(HttpServletRequest request)
从接口复制的说明:ThemeResolver
Resolve the current theme name via the given request. Should return a default theme as fallback in any case.- 指定者:
resolveThemeName
在接口中ThemeResolver
- 参数:
request
- request to be used for resolution- 返回:
- the current theme name
setThemeName
public void setThemeName(HttpServletRequest request, HttpServletResponse response, String themeName)
从接口复制的说明:ThemeResolver
Set the current theme name to the given one.- 指定者:
setThemeName
在接口中ThemeResolver
- 参数:
request
- request to be used for theme name modificationresponse
- response to be used for theme name modificationthemeName
- the new theme name