public abstract class AbstractLocaleContextResolver extends AbstractLocaleResolver implements LocaleContextResolver
LocaleContextResolver
implementations.
Provides support for a default locale and a default time zone.
Also provides pre-implemented versions of resolveLocale(javax.servlet.http.HttpServletRequest)
and setLocale(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.util.Locale)
,
delegating to LocaleContextResolver.resolveLocaleContext(javax.servlet.http.HttpServletRequest)
and LocaleContextResolver.setLocaleContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.springframework.context.i18n.LocaleContext)
.
AbstractLocaleResolver.setDefaultLocale(java.util.Locale)
,
setDefaultTimeZone(java.util.TimeZone)
Constructor and Description |
---|
AbstractLocaleContextResolver() |
Modifier and Type | Method and Description |
---|---|
TimeZone |
getDefaultTimeZone()
Get the default
TimeZone that this resolver is supposed to fall
back to, if any. |
Locale |
resolveLocale(HttpServletRequest request)
Resolve the current locale via the given request.
|
void |
setDefaultTimeZone(TimeZone defaultTimeZone)
Set a default
TimeZone that this resolver will return if no other
time zone is found. |
void |
setLocale(HttpServletRequest request,
HttpServletResponse response,
Locale locale)
Set the current locale to the given one.
|
getDefaultLocale, setDefaultLocale
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
resolveLocaleContext, setLocaleContext
public void setDefaultTimeZone(@Nullable TimeZone defaultTimeZone)
TimeZone
that this resolver will return if no other
time zone is found.@Nullable public TimeZone getDefaultTimeZone()
TimeZone
that this resolver is supposed to fall
back to, if any.public Locale resolveLocale(HttpServletRequest request)
LocaleResolver
Can return a default locale as fallback in any case.
resolveLocale
in interface LocaleResolver
request
- the request to resolve the locale fornull
)public void setLocale(HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable Locale locale)
LocaleResolver
setLocale
in interface LocaleResolver
request
- 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