How to retrieve URL from browse in Vaadin

Viewed 47

I want to store URL of from browser in a Java String. Below is my code URL which opens up UI for creating password.

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

I'm using Vaadin 23

1 Answers
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);
});

Read more: https://vaadin.com/docs/latest/advanced/browser-access

Related