Top Description Methods
org.springframework.web.server.i18n

public Interface LocaleContextResolver

Known Direct Implementers
org.springframework.web.server.i18n.AcceptHeaderLocaleContextResolver, org.springframework.web.server.i18n.FixedLocaleContextResolver
Imports
org.springframework.context.i18n.LocaleContext, org.springframework.lang.Nullable, org.springframework.web.server.ServerWebExchange

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 org.springframework.context.i18n.LocaleContext object can potentially include associated time zone and other locale related information.

Author
Sebastien Deleuze
Since
5.0
See Also
LocaleContext

Method Summary

Modifier and TypeMethod and Description
public LocaleContext

Returns:

the current locale context (never null)
resolveLocaleContext
(ServerWebExchange
current server exchange
exchange
)

Resolve the current locale context via the given exchange.

public void
setLocaleContext(ServerWebExchange
current server exchange
exchange
,
LocaleContext
the new locale context, or null to clear the locale
localeContext
)

Set the current locale context to the given one, potentially including a locale with associated time zone information.

Method Detail

resolveLocaleContextback to summary
public LocaleContext resolveLocaleContext(ServerWebExchange exchange)

Resolve the current locale context via the given exchange.

The returned context may be a org.springframework.context.i18n.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.

Parameters
exchange:ServerWebExchange

current server exchange

Returns:LocaleContext

the current locale context (never null)

setLocaleContextback to summary
public void setLocaleContext(ServerWebExchange exchange, LocaleContext localeContext)

Set the current locale context to the given one, potentially including a locale with associated time zone information.

Parameters
exchange:ServerWebExchange

current server exchange

localeContext:LocaleContext

the new locale context, or null to clear the locale

Exceptions
UnsupportedOperationException:
if the LocaleResolver implementation does not support dynamic changing of the locale or time zone
See Also
org.springframework.context.i18n.SimpleLocaleContext, org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext