Class ChainLocaleResolver
java.lang.Object
org.springframework.web.servlet.i18n.AbstractLocaleResolver
org.craftercms.engine.util.spring.servlet.i18n.ChainLocaleResolver
- All Implemented Interfaces:
org.springframework.web.servlet.LocaleResolver
public class ChainLocaleResolver
extends org.springframework.web.servlet.i18n.AbstractLocaleResolver
Implementation of
LocaleResolver
that uses a chain of other LocaleResolver
s.
The resolvers will be executed according to the order in the configuration file, and the chain will stop when one of the resolvers returns a supported locale. If none of the resolvers in the chain returns a locale the default one will be used.
The chain of resolvers will be executed one time for every request and the locale will be stored until the response completed.
- Since:
- 4.0.0
- Author:
- joseross
-
Field Summary
-
Constructor Summary
ConstructorDescriptionChainLocaleResolver
(org.springframework.context.ApplicationContext appContext, org.apache.commons.configuration2.HierarchicalConfiguration<?> config) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
isSupported
(Locale locale) resolveLocale
(javax.servlet.http.HttpServletRequest request) void
setLocale
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Locale locale) Methods inherited from class org.springframework.web.servlet.i18n.AbstractLocaleResolver
getDefaultLocale, setDefaultLocale
-
Field Details
-
ATTR_NAME_LOCALE
-
BEAN_NAME_PATTERN
- See Also:
-
CONFIG_KEY_LOCALE_RESOLVER
- See Also:
-
CONFIG_KEY_TYPE
- See Also:
-
supportedLocales
The list of supported locales -
resolvers
The list ofLocaleResolver
s
-
-
Constructor Details
-
ChainLocaleResolver
public ChainLocaleResolver(org.springframework.context.ApplicationContext appContext, org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
-
-
Method Details
-
isSupported
-
resolveLocale
-
setLocale
public void setLocale(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Locale locale)
-