[英]How to manage sessions in Vaadin 10?
I have a web page in Vaadin 10 that process files. 我在Vaadin 10中有一个处理文件的网页。 How do I make different user have different sessions?
如何让不同的用户拥有不同的会话? When I try to open my page in different browsers to process files I get:
当我尝试在不同的浏览器中打开我的页面来处理文件时,我得到:
java.lang.IllegalStateException: Cannot access state in VaadinSession or UI without locking the session.
I can't find any useful information or tutorial in official documentation. 我在官方文档中找不到任何有用的信息或教程。 Currently I look through Baker App - but I can't find there anything about sessions either.
目前我通过Baker App查看 - 但我找不到有关会话的任何内容。
Vaadin Version: 10.0.0.rc3 Vaadin版本:10.0.0.rc3
Spring Boot Version: 2.0.3.RELEASE Spring Boot版本:2.0.3.RELEASE
Java: 1.8 Java:1.8
Actually, it is mentioned in the documentation. 实际上,文档中提到了它。 Take a look at its Javadoc here .
在这里看看它的Javadoc。 Based on that document, you need to access session like this:
根据该文档,您需要访问如下会话:
String someValue = null;
session.lock();
try {
someValue = session.getAttribute("SomeKey");
} finally {
session.unlock();
}
The complete Javadoc of different versions of Vaadin framework can be seen here . 可以在这里看到不同版本的Vaadin框架的完整Javadoc。
By the way, I suggest you use the latest version of Vaadin flow which is 10.0.1 顺便说一句,我建议你使用最新版本的Vaadin flow 10.0.1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.