LocaleResolver that adds support for a rich locale context
(potentially including locale and time zone information).
Also provides default implementations of resolveLocale and
setLocale which delegate to resolveLocaleContext and
setLocaleContext, respectively.
org.springframework.context.i18n.LocaleContext , org.springframework.context.i18n.TimeZoneAwareLocaleContext , org.springframework.context.i18n.LocaleContextHolder , org.springframework.web.servlet.support.RequestContext#getTimeZone , org.springframework.web.servlet.support.RequestContextUtils#getTimeZone
| Modifier and Type | Method and Description |
|---|---|
| public default Locale | Returns: the current locale (nevernull)the request to resolve the locale for request)Implements org. Default implementation of |
| public LocaleContext | Returns: the current locale context (nevernullthe request to resolve the locale context for request)Resolve the current locale context via the given request. |
| public default void | setLocale(HttpServletRequest
the request to be used for locale modification request, HttpServletResponse the response to be used for locale modification response, Locale the new locale, or locale)null to clear the localeImplements org. Default implementation of |
| public void | setLocaleContext(HttpServletRequest
the request to be used for locale modification request, HttpServletResponse the response to be used for locale modification response, LocaleContext the new locale context, or localeContext)null to clear the localeSet the current locale context to the given one, potentially including a locale with associated time zone information. |
| resolveLocale | back to summary |
|---|---|
| public default Locale resolveLocale(HttpServletRequest request) Implements org. Default implementation of
| |
| resolveLocaleContext | back to summary |
|---|---|
| public LocaleContext resolveLocaleContext(HttpServletRequest request) Resolve the current locale context via the given request. This is primarily intended for framework-level processing; consider using
The returned context may be a
Custom resolver implementations may also return extra settings in the returned context, which again can be accessed through downcasting.
| |
| setLocale | back to summary |
|---|---|
| public default void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) Implements org. Default implementation of
| |
| setLocaleContext | back to summary |
|---|---|
| public void setLocaleContext(HttpServletRequest request, HttpServletResponse response, LocaleContext localeContext) Set the current locale context to the given one, potentially including a locale with associated time zone information.
| |