Interface LocaleContextResolver

All Known Implementing Classes:
AcceptHeaderLocaleContextResolver, FixedLocaleContextResolver

public interface LocaleContextResolver
Interface for web-based locale context resolution strategies that allows for both locale context resolution via the request and locale context modification via the HTTP exchange.

The LocaleContext object can potentially includes associated time zone and other locale related information.

Since:
5.0
Author:
Sebastien Deleuze
See Also:
  • Method Details

    • resolveLocaleContext

      LocaleContext resolveLocaleContext(ServerWebExchange exchange)
      Resolve the current locale context via the given exchange.

      The returned context may be a TimeZoneAwareLocaleContext, containing a locale with associated time zone information. Simply apply an instanceof check and downcast accordingly.

      Custom resolver implementations may also return extra settings in the returned context, which again can be accessed through downcasting.

      Parameters:
      exchange - current server exchange
      Returns:
      the current locale context (never null)
    • setLocaleContext

      void setLocaleContext(ServerWebExchange exchange, @Nullable LocaleContext localeContext)
      Set the current locale context to the given one, potentially including a locale with associated time zone information.
      Parameters:
      exchange - current server exchange
      localeContext - the new locale context, or null to clear the locale
      Throws:
      UnsupportedOperationException - if the LocaleResolver implementation does not support dynamic changing of the locale or time zone
      See Also: