类 SessionThemeResolver
- java.lang.Object
- org.springframework.web.servlet.theme.AbstractThemeResolver
- org.springframework.web.servlet.theme.SessionThemeResolver
- 所有已实现的接口:
ThemeResolver
public class SessionThemeResolver extends AbstractThemeResolver
ThemeResolver
implementation that uses a theme attribute in the user's session in case of a custom setting, with a fallback to the default theme. This is most appropriate if the application needs user sessions anyway.Custom controllers can override the user's theme by calling
setThemeName
, e.g. responding to a 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
THEME_SESSION_ATTRIBUTE_NAME
Name of the session attribute that holds the theme name.从类继承的字段 org.springframework.web.servlet.theme.AbstractThemeResolver
ORIGINAL_DEFAULT_THEME_NAME
构造器概要
构造器 构造器 说明 SessionThemeResolver()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 String
resolveThemeName(HttpServletRequest request)
Resolve the current theme name via the given request.void
setThemeName(HttpServletRequest request, HttpServletResponse response, String themeName)
Set the current theme name to the given one.从类继承的方法 org.springframework.web.servlet.theme.AbstractThemeResolver
getDefaultThemeName, setDefaultThemeName
字段详细资料
THEME_SESSION_ATTRIBUTE_NAME
public static final String THEME_SESSION_ATTRIBUTE_NAME
Name of the session attribute that holds the theme name. Only used internally by this implementation. UseRequestContext(Utils).getTheme()
to retrieve the current theme in controllers or views.
构造器详细资料
SessionThemeResolver
public SessionThemeResolver()
方法详细资料
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.- 参数:
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.- 参数:
request
- request to be used for theme name modificationresponse
- response to be used for theme name modificationthemeName
- the new theme name