public class FixedLocaleResolver extends AbstractLocaleResolver
LocaleResolver implementation
that always returns a fixed default locale. Default is the current
JVM's default locale.
Note: Does not support setLocale, as the fixed locale
cannot be changed.
AbstractLocaleResolver.setDefaultLocale(java.util.Locale)| Constructor and Description |
|---|
FixedLocaleResolver()
Create a default FixedLocaleResolver, exposing a configured default
locale (or the JVM's default locale as fallback).
|
FixedLocaleResolver(Locale locale)
Create a FixedLocaleResolver that exposes the given locale.
|
| Modifier and Type | Method and Description |
|---|---|
Locale |
resolveLocale(HttpServletRequest request)
Resolve the current locale via the given request.
|
void |
setLocale(HttpServletRequest request,
HttpServletResponse response,
Locale locale)
Set the current locale to the given one.
|
getDefaultLocale, setDefaultLocalepublic FixedLocaleResolver()
public FixedLocaleResolver(Locale locale)
locale - the locale to exposepublic Locale resolveLocale(HttpServletRequest request)
LocaleResolverrequest - the request to resolve the locale fornull)public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale)
LocaleResolverrequest - the request to be used for locale modificationresponse - the response to be used for locale modificationlocale - the new locale, or null to clear the locale