Class CookieLocaleResolver

java.lang.Object
org.craftercms.engine.util.spring.servlet.i18n.ConfigAwareLocaleResolver
org.craftercms.engine.util.spring.servlet.i18n.CookieLocaleResolver
All Implemented Interfaces:
org.springframework.web.servlet.LocaleResolver

public class CookieLocaleResolver extends ConfigAwareLocaleResolver
Implementation of ConfigAwareLocaleResolver that reads the locale from a cookie.

Supported configuration properties:

  • cookieName: The name of the cookie to read, the site name will be appended, defaults to a global configurable value
Since:
4.0.0
Author:
joseross
  • Field Details

    • cookieName

      protected String cookieName
      The name of the cookie
    • defaultCookieName

      protected String defaultCookieName
      The default name of the cookie, provided for backward compatibility
  • Constructor Details

  • Method Details

    • init

      protected void init(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
      Description copied from class: ConfigAwareLocaleResolver
      Performs any customization needed
      Specified by:
      init in class ConfigAwareLocaleResolver
      Parameters:
      config - the configuration
    • resolveLocale

      protected 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 class ConfigAwareLocaleResolver
      Parameters:
      siteContext - the current site context
      request - the current request
      Returns:
      a locale object or null