Class GroovyLocaleResolver
- java.lang.Object
-
- org.craftercms.engine.util.spring.servlet.i18n.ConfigAwareLocaleResolver
-
- org.craftercms.engine.util.spring.servlet.i18n.GroovyLocaleResolver
-
- All Implemented Interfaces:
org.springframework.web.servlet.LocaleResolver
public class GroovyLocaleResolver extends ConfigAwareLocaleResolver
Implementation ofConfigAwareLocaleResolver
that executes a Groovy script to resolve the localeSupported configuration properties:
- script: The path of the Groovy script in the site, defaults to
/scripts/locale/resolver.groovy
- Since:
- 4.0.0
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_KEY_SCRIPT
static String
DEFAULT_SCRIPT
protected String
scriptPath
The path of the Groovy script-
Fields inherited from class org.craftercms.engine.util.spring.servlet.i18n.ConfigAwareLocaleResolver
logger
-
-
Constructor Summary
Constructors Constructor Description GroovyLocaleResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
init(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Performs any customization neededLocale
resolveLocale(SiteContext siteContext, javax.servlet.http.HttpServletRequest request)
Performs the actual work to resolve a locale-
Methods inherited from class org.craftercms.engine.util.spring.servlet.i18n.ConfigAwareLocaleResolver
isSupported, resolveLocale, setLocale, setSupportedLocales
-
-
-
-
Field Detail
-
CONFIG_KEY_SCRIPT
public static final String CONFIG_KEY_SCRIPT
- See Also:
- Constant Field Values
-
DEFAULT_SCRIPT
public static final String DEFAULT_SCRIPT
- See Also:
- Constant Field Values
-
scriptPath
protected String scriptPath
The path of the Groovy script
-
-
Method Detail
-
init
protected void init(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
Description copied from class:ConfigAwareLocaleResolver
Performs any customization needed- Specified by:
init
in classConfigAwareLocaleResolver
- Parameters:
config
- the configuration
-
resolveLocale
public Locale resolveLocale(SiteContext siteContext, javax.servlet.http.HttpServletRequest request)
Description copied from class:ConfigAwareLocaleResolver
Performs the actual work to resolve a locale- Specified by:
resolveLocale
in classConfigAwareLocaleResolver
- Parameters:
siteContext
- the current site contextrequest
- the current request- Returns:
- a locale object or null
-
-