Class ConfigAwareLocaleResolver
java.lang.Object
org.craftercms.engine.util.spring.servlet.i18n.ConfigAwareLocaleResolver
- All Implemented Interfaces:
org.springframework.web.servlet.LocaleResolver
- Direct Known Subclasses:
CookieLocaleResolver
,GroovyLocaleResolver
,HeaderLocaleResolver
,PrincipalLocaleResolver
,UrlPatternLocaleResolver
public abstract class ConfigAwareLocaleResolver
extends Object
implements org.springframework.web.servlet.LocaleResolver
Base implementation for
LocaleResolver
by the ChainLocaleResolver
.
Resolvers extending this class can be customized using configuration properties and should never implement
the setLocale
method because the ChainLocaleResolver
handles that.
- Since:
- 4.0.0
- Author:
- joseross
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
init
(org.apache.commons.configuration2.HierarchicalConfiguration<?> config) Performs any customization neededprotected boolean
isSupported
(Locale locale) resolveLocale
(javax.servlet.http.HttpServletRequest request) protected abstract Locale
resolveLocale
(SiteContext siteContext, javax.servlet.http.HttpServletRequest request) Performs the actual work to resolve a localevoid
setLocale
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Locale locale) void
setSupportedLocales
(List<Locale> supportedLocales)
-
Field Details
-
logger
protected final org.slf4j.Logger logger
-
-
Constructor Details
-
ConfigAwareLocaleResolver
public ConfigAwareLocaleResolver()
-
-
Method Details
-
setSupportedLocales
-
isSupported
-
init
protected abstract void init(org.apache.commons.configuration2.HierarchicalConfiguration<?> config) Performs any customization needed- Parameters:
config
- the configuration
-
resolveLocale
- Specified by:
resolveLocale
in interfaceorg.springframework.web.servlet.LocaleResolver
-
resolveLocale
protected abstract Locale resolveLocale(SiteContext siteContext, javax.servlet.http.HttpServletRequest request) Performs the actual work to resolve a locale- Parameters:
siteContext
- the current site contextrequest
- the current request- Returns:
- a locale object or null
-
setLocale
public void setLocale(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Locale locale) - Specified by:
setLocale
in interfaceorg.springframework.web.servlet.LocaleResolver
-