Class VaadinSessionLocaleServiceInitListener

java.lang.Object
de.codecamp.messages.spring.vaadin.VaadinSessionLocaleServiceInitListener
All Implemented Interfaces:
com.vaadin.flow.server.VaadinServiceInitListener, Serializable, EventListener

public class VaadinSessionLocaleServiceInitListener extends Object implements com.vaadin.flow.server.VaadinServiceInitListener
This VaadinServiceInitListener is responsible for updating the locale and time zone in Spring's LocaleContextHolder at the start of each browser request from the current VaadinSession.

It also initializes the session's time zone (stored in a custom attribute} by detecting it from the browser. Due to the second roundtrip to the client that is required, the time zone might not be available during the very first request of a new session. If the time zone is already set in the session through other means it will not be overridden.

See Also:
  • Constructor Details

    • VaadinSessionLocaleServiceInitListener

      public VaadinSessionLocaleServiceInitListener()
  • Method Details

    • serviceInit

      public void serviceInit(com.vaadin.flow.server.ServiceInitEvent serviceInitEvent)
      Specified by:
      serviceInit in interface com.vaadin.flow.server.VaadinServiceInitListener