Class Overview
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.
Summary
[Expand]
Inherited Methods |
From class
org.springframework.web.util.CookieGenerator
void
|
addCookie(HttpServletResponse response, String cookieValue)
Add a cookie with the given value to the response,
using the cookie descriptor settings of this generator.
|
Cookie
|
createCookie(String cookieValue)
Create a cookie with the given value, using the cookie descriptor
settings of this generator (except for "cookieMaxAge").
|
String
|
getCookieDomain()
Return the domain for cookies created by this generator, if any.
|
Integer
|
getCookieMaxAge()
Return the maximum age for cookies created by this generator.
|
String
|
getCookieName()
Return the given name for cookies created by this generator.
|
String
|
getCookiePath()
Return the path for cookies created by this generator.
|
boolean
|
isCookieSecure()
Return whether the cookie should only be sent using a secure protocol,
such as HTTPS (SSL).
|
void
|
removeCookie(HttpServletResponse response)
Remove the cookie that this generator describes from the response.
|
void
|
setCookieDomain(String cookieDomain)
Use the given domain for cookies created by this generator.
|
void
|
setCookieMaxAge(Integer cookieMaxAge)
Use the given maximum age (in seconds) for cookies created by this generator.
|
void
|
setCookieName(String cookieName)
Use the given name for cookies created by this generator.
|
void
|
setCookiePath(String cookiePath)
Use the given path for cookies created by this generator.
|
void
|
setCookieSecure(boolean cookieSecure)
Set whether the cookie should only be sent using a secure protocol,
such as HTTPS (SSL).
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
From interface
org.springframework.web.servlet.ThemeResolver
abstract
String
|
resolveThemeName(HttpServletRequest request)
Resolve the current theme name via the given request.
|
abstract
void
|
setThemeName(HttpServletRequest request, HttpServletResponse response, String themeName)
Set the current theme name to the given one.
|
|
Constants
public
static
final
String
ORIGINAL_DEFAULT_THEME_NAME
Fields
public
static
final
String
DEFAULT_COOKIE_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.
Public Constructors
public
CookieThemeResolver
()
Public Methods
public
String
getDefaultThemeName
()
Return the name of the default theme.
public
String
resolveThemeName
(HttpServletRequest request)
Resolve the current theme name via the given request.
Should return a default theme as fallback in any case.
Parameters
request
| request to be used for resolution |
public
void
setDefaultThemeName
(String defaultThemeName)
Set the name of the default theme.
public
void
setThemeName
(HttpServletRequest request, HttpServletResponse response, String themeName)
Set the current theme name to the given one.
Parameters
request
| request to be used for theme name modification |
response
| response to be used for theme name modification |
themeName
| the new theme name |