类 FixedLocaleContextResolver
- java.lang.Object
- org.springframework.web.server.i18n.FixedLocaleContextResolver
- 所有已实现的接口:
LocaleContextResolver
public class FixedLocaleContextResolver extends Object implements LocaleContextResolver
LocaleContextResolver
implementation that always returns a fixed locale and optionally time zone. Default is the current JVM's default locale.Note: Does not support
setLocaleContext(org.springframework.web.server.ServerWebExchange, org.springframework.context.i18n.LocaleContext)
, as the fixed locale and time zone cannot be changed.- 从以下版本开始:
- 5.0
- 作者:
- Sebastien Deleuze
构造器概要
构造器 构造器 说明 FixedLocaleContextResolver()
Create a default FixedLocaleResolver, exposing a configured default locale (or the JVM's default locale as fallback).FixedLocaleContextResolver(Locale locale)
Create a FixedLocaleResolver that exposes the given locale.FixedLocaleContextResolver(Locale locale, TimeZone timeZone)
Create a FixedLocaleResolver that exposes the given locale and time zone.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.
构造器详细资料
FixedLocaleContextResolver
public FixedLocaleContextResolver()
Create a default FixedLocaleResolver, exposing a configured default locale (or the JVM's default locale as fallback).
FixedLocaleContextResolver
public FixedLocaleContextResolver(Locale locale)
Create a FixedLocaleResolver that exposes the given locale.- 参数:
locale
- the locale to expose
FixedLocaleContextResolver
public FixedLocaleContextResolver(Locale locale, @Nullable TimeZone timeZone)
Create a FixedLocaleResolver that exposes the given locale and time zone.- 参数:
locale
- the locale to exposetimeZone
- the time zone to expose
方法详细资料
resolveLocaleContext
public LocaleContext resolveLocaleContext(ServerWebExchange exchange)
从接口复制的说明:LocaleContextResolver
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.
- 指定者:
resolveLocaleContext
在接口中LocaleContextResolver
- 参数:
exchange
- current server exchange- 返回:
- the current locale context (never
null
)
setLocaleContext
public void setLocaleContext(ServerWebExchange exchange, @Nullable LocaleContext localeContext)
从接口复制的说明:LocaleContextResolver
Set the current locale context to the given one, potentially including a locale with associated time zone information.- 指定者:
setLocaleContext
在接口中LocaleContextResolver
- 参数:
exchange
- current server exchangelocaleContext
- the new locale context, ornull
to clear the locale- 另请参阅:
SimpleLocaleContext
,SimpleTimeZoneAwareLocaleContext