接口 LocaleContextResolver
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.- 从以下版本开始:
- 5.0
- 作者:
- Sebastien Deleuze
- 另请参阅:
LocaleContext
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 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.
方法详细资料
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 aninstanceof
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 exchange- 返回:
- 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.- 参数:
exchange
- current server exchangelocaleContext
- the new locale context, ornull
to clear the locale- 抛出:
UnsupportedOperationException
- if the LocaleResolver implementation does not support dynamic changing of the locale or time zone- 另请参阅:
SimpleLocaleContext
,SimpleTimeZoneAwareLocaleContext