如何从 Vaadin 中的浏览中检索 URL

Dat*_*nde 1 java vaadin

我想将浏览器的 URL 存储在 Java 字符串中。下面是我的代码 URL,它打开用于创建密码的 UI。

http://localhost:8080/createpassword?userId=1

我正在使用 Vaadin 23

Sim*_*lli 5

UI.getCurrent().getPage().fetchCurrentURL(currentUrl -> {
    // This is your own method that you may do something with the url.
    // Please note that this method runs asynchronously
    storeCurrentURL(currentUrl);
});
Run Code Online (Sandbox Code Playgroud)

了解更多: https: //vaadin.com/docs/latest/advanced/browser-access