Class ThreadLocalLocaleResolver
java.lang.Object
io.github.belgif.rest.problem.ee.jaxrs.i18n.ThreadLocalLocaleResolver
- All Implemented Interfaces:
LocaleResolver
LocaleResolver implementation that uses a ThreadLocal.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ThreadLocalLocaleResolver
public ThreadLocalLocaleResolver()
-
-
Method Details
-
getLocale
Description copied from interface:LocaleResolver
Get the current Locale- Specified by:
getLocale
in interfaceLocaleResolver
- Returns:
- the current Locale
-
setLocale
Set the locale of the current request.NOTE: The locale is stored in a ThreadLocal that must be cleaned up with
clear()
.- Parameters:
locale
- the locale of the current request.
-
clear
public static void clear()Clear the locale of the current request.
-