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 forLocaleResolver
by theChainLocaleResolver
.Resolvers extending this class can be customized using configuration properties and should never implement the
setLocale
method because theChainLocaleResolver
handles that.- Since:
- 4.0.0
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
logger
-
Constructor Summary
Constructors Constructor Description ConfigAwareLocaleResolver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
init(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Performs any customization neededprotected boolean
isSupported(Locale 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)
-
-
-
Method Detail
-
isSupported
protected boolean isSupported(Locale locale)
-
init
protected abstract void init(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Performs any customization needed- Parameters:
config
- the configuration
-
resolveLocale
public Locale resolveLocale(javax.servlet.http.HttpServletRequest request)
- 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
-
-