java.lang.Object | |
↳ | org.springframework.context.i18n.LocaleContextHolder |
Simple holder class that associates a LocaleContext instance
with the current thread. The LocaleContext will be inherited
by any child threads spawned by the current thread if the
Used as a central holder for the current Locale in Spring,
wherever necessary: for example, in MessageSourceAccessor.
DispatcherServlet automatically exposes its current Locale here.
Other applications can expose theirs too, to make classes like
MessageSourceAccessor automatically use that Locale.inheritable
flag is set to
true
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the Locale associated with the current thread, if any,
or the system default Locale else.
| |||||||||||
Return the LocaleContext associated with the current thread, if any.
| |||||||||||
Reset the LocaleContext for the current thread.
| |||||||||||
Associate the given Locale with the current thread.
| |||||||||||
Associate the given Locale with the current thread.
| |||||||||||
Associate the given LocaleContext with the current thread,
not exposing it as inheritable for child threads.
| |||||||||||
Associate the given LocaleContext with the current thread.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Return the Locale associated with the current thread, if any, or the system default Locale else.
Return the LocaleContext associated with the current thread, if any.
null
if none
Reset the LocaleContext for the current thread.
Associate the given Locale with the current thread.
Will implicitly create a LocaleContext for the given Locale.
locale | the current Locale, or null to reset
the thread-bound context |
---|---|
inheritable | whether to expose the LocaleContext as inheritable
for child threads (using an InheritableThreadLocal ) |
Associate the given Locale with the current thread.
Will implicitly create a LocaleContext for the given Locale, not exposing it as inheritable for child threads.
locale | the current Locale, or null to reset
the thread-bound context |
---|
Associate the given LocaleContext with the current thread, not exposing it as inheritable for child threads.
localeContext | the current LocaleContext |
---|
Associate the given LocaleContext with the current thread.
localeContext | the current LocaleContext,
or null to reset the thread-bound context |
---|---|
inheritable | whether to expose the LocaleContext as inheritable
for child threads (using an InheritableThreadLocal )
|