Session Handling in Vaadin

I have an application Vaadinthat starts with user login, but the problem with Vaadinis session processing, since I can open two sessions from two different browsers with the same login, which should not be possible. But I did not find any documentation on this other than this topic , but it does not work properly, because the data is not saved in hashmapcorrectly. Did everyone have the same problem?

+4
source share
3 answers

Vaadin 7 works by default, so every time a new instance of the user interface is created when a new browser tab is opened (or the tab is updated). You must store the current user information in VaadinSessionor standard HttpSessionand check UI.init()if the session contains user information.

To store information in VaadinSession, we can say:

VaadinSession.getCurrent().setAttribute("currentUser", currentUser)

In Vaadin, you can access HttpSession as follows:

VaadinSession.getCurrent().getSession()

Please note that they VaadinSessionare stored in HttpSession, and HttpSessionmay contain several VaadinSession, if several Vaadin servlets are deployed from the same war file, and the user uses them at the same time.

+3
source

How to prevent simultaneous login?

, -. 32 128 , cookie , .

(A) User (B), - cookie .

(A) (, , ) , (B) , (A) , ​​ , .

. , STATE .

+1

You can save all registered users to static dialing. Static variables are globally shared. In the starting application, check if the collection is already a login.

0
source

All Articles