java.lang.Object
de.codecamp.messages.spring.vaadin.SessionLocaleUtils

public class SessionLocaleUtils extends Object
Utility class to change the Locale and/or TimeZone of a Vaadin session from the initial values that have been determined automatically. E.g. after logging in when a user's explicit settings could be loaded.
  • Constructor Details

    • SessionLocaleUtils

      public SessionLocaleUtils()
  • Method Details

    • getSessionLocale

      public static Locale getSessionLocale()
      Returns the locale of the current session.
      Returns:
      the session locale
    • setSessionLocale

      public static void setSessionLocale(Locale locale)
      Updates the locale of the current session.
      Parameters:
      locale - the new session locale
    • getSessionLocale

      public static Locale getSessionLocale(com.vaadin.flow.server.VaadinSession session)
      Returns the locale of the given session.

      This method cannot be called while already holding the lock to a different Vaadin session than the provided one.

      Parameters:
      session - the session to update
      Returns:
      the session locale
    • setSessionLocale

      public static void setSessionLocale(com.vaadin.flow.server.VaadinSession session, Locale locale)
      Updates the locale of the given session.

      This method cannot be called while already holding the lock to a different Vaadin session than the provided one.

      Parameters:
      session - the session to update
      locale - the new session locale
    • getSessionTimeZone

      public static TimeZone getSessionTimeZone()
      Returns the time zone of the current session.
      Returns:
      the session time zone
    • setSessionTimeZone

      public static void setSessionTimeZone(TimeZone timeZone)
      Updates the time zone of the current session.
      Parameters:
      timeZone - the new session time zone
    • getSessionTimeZone

      public static TimeZone getSessionTimeZone(com.vaadin.flow.server.VaadinSession session)
      Returns the time zone of the given session.

      This method cannot be called while already holding the lock to a different Vaadin session than the provided one.

      Parameters:
      session - the session to update
      Returns:
      the session time zone
    • setSessionTimeZone

      public static void setSessionTimeZone(com.vaadin.flow.server.VaadinSession session, TimeZone timeZone)
      Updates the time zone of the given session.

      This method cannot be called while already holding the lock to a different Vaadin session than the provided one.

      Parameters:
      session - the session to update
      timeZone - the new session time zone