Class ThreadLocalLocaleResolver

java.lang.Object
io.github.belgif.rest.problem.ee.server.jaxrs.i18n.ThreadLocalLocaleResolver
All Implemented Interfaces:
io.github.belgif.rest.problem.i18n.LocaleResolver

public class ThreadLocalLocaleResolver extends Object implements io.github.belgif.rest.problem.i18n.LocaleResolver
LocaleResolver implementation that uses a ThreadLocal.
  • Constructor Details

    • ThreadLocalLocaleResolver

      public ThreadLocalLocaleResolver()
  • Method Details

    • getLocale

      public Locale getLocale()
      Specified by:
      getLocale in interface io.github.belgif.rest.problem.i18n.LocaleResolver
    • setLocale

      public static void setLocale(Locale locale)
      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.