public interface LocaleContextResolver
The LocaleContext
object can potentially
includes associated time zone and other locale related information.
LocaleContext
Modifier and Type | Method and Description |
---|---|
LocaleContext |
resolveLocaleContext(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.
|
LocaleContext resolveLocaleContext(ServerWebExchange 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.
exchange
- current server exchangenull
)void setLocaleContext(ServerWebExchange exchange, @Nullable LocaleContext localeContext)
exchange
- current server exchangelocaleContext
- the new locale context, or null
to clear the localejava.lang.UnsupportedOperationException
- if the LocaleResolver implementation
does not support dynamic changing of the locale or time zoneSimpleLocaleContext
,
SimpleTimeZoneAwareLocaleContext