类 FixedLocaleContextResolver
- java.lang.Object
- org.springframework.web.server.i18n.FixedLocaleContextResolver
- 所有已实现的接口:
LocaleContextResolver
public class FixedLocaleContextResolver extends Object implements LocaleContextResolver
LocaleContextResolverimplementation 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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 LocaleContextresolveLocaleContext(ServerWebExchange exchange)Resolve the current locale context via the given exchange.voidsetLocaleContext(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)
从接口复制的说明:LocaleContextResolverResolve 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 aninstanceofcheck 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)
从接口复制的说明:LocaleContextResolverSet 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, ornullto clear the locale- 另请参阅:
SimpleLocaleContext,SimpleTimeZoneAwareLocaleContext