Package net.solarnetwork.web.support
Class UrlPathThemeResolver
java.lang.Object
org.springframework.web.util.CookieGenerator
org.springframework.web.servlet.theme.CookieThemeResolver
net.solarnetwork.web.support.UrlPathThemeResolver
- All Implemented Interfaces:
org.springframework.web.servlet.ThemeResolver
public class UrlPathThemeResolver
extends org.springframework.web.servlet.theme.CookieThemeResolver
ThemeResolver that resolves a theme name from a URL path variable.
This class extends CookieThemeResolver and as such uses cookies to
persist the theme with the client browser. The theme can be changed (or
initially set) by passing a URL path variable with the HTTP request, for
example /path/to/something.html;theme=mytheme.
The configurable properties of this class are:
- themePathVariable
- The name of the URL path variable to look for the current theme in.
Defaults to
DEFAULT_THEME_PATH_VARIABLE.
- Version:
- 1.0
- Author:
- matt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault value for thethemePathVariableproperty.Fields inherited from class org.springframework.web.servlet.theme.CookieThemeResolver
DEFAULT_COOKIE_NAME, ORIGINAL_DEFAULT_THEME_NAME, THEME_REQUEST_ATTRIBUTE_NAMEFields inherited from class org.springframework.web.util.CookieGenerator
DEFAULT_COOKIE_PATH, logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the theme path variable name.resolveThemeName(javax.servlet.http.HttpServletRequest request) voidsetThemePathVariable(String themePathVariable) Set the theme path variable name.Methods inherited from class org.springframework.web.servlet.theme.CookieThemeResolver
getDefaultThemeName, setDefaultThemeName, setThemeNameMethods inherited from class org.springframework.web.util.CookieGenerator
addCookie, createCookie, getCookieDomain, getCookieMaxAge, getCookieName, getCookiePath, isCookieHttpOnly, isCookieSecure, removeCookie, setCookieDomain, setCookieHttpOnly, setCookieMaxAge, setCookieName, setCookiePath, setCookieSecure
-
Field Details
-
DEFAULT_THEME_PATH_VARIABLE
Default value for thethemePathVariableproperty.- See Also:
-
-
Constructor Details
-
UrlPathThemeResolver
public UrlPathThemeResolver()Default constructor.
-
-
Method Details
-
resolveThemeName
- Specified by:
resolveThemeNamein interfaceorg.springframework.web.servlet.ThemeResolver- Overrides:
resolveThemeNamein classorg.springframework.web.servlet.theme.CookieThemeResolver
-
getThemePathVariable
Get the theme path variable name.- Returns:
- the variable name
-
setThemePathVariable
Set the theme path variable name.- Parameters:
themePathVariable- the path variable name
-