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 Summary
Modifier and TypeMethodDescriptionresolveLocaleContext
(ServerWebExchange exchange) Resolve the current locale context via the given exchange.void
setLocaleContext
(ServerWebExchange exchange, LocaleContext localeContext) Set the current locale context to the given one, potentially including a locale with associated time zone information.
-
Method Details
-
resolveLocaleContext
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 aninstanceof
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
Set the current locale context to the given one, potentially including a locale with associated time zone information.- Parameters:
exchange
- current server exchangelocaleContext
- the new locale context, ornull
to clear the locale- Throws:
UnsupportedOperationException
- if the LocaleResolver implementation does not support dynamic changing of the locale or time zone- See Also:
-