I need to get the current servers name an all the other information stored in the URI
.
In Vaadin 8 it was accessible thru the Page
by calling something like this:
URI uri = Page.getCurrent().getLocation();
In Flow the Page
does not contain such information:
An neither does the Router
afaik.
How do I get the URI
?
Thank you in advance.
Since Vaadin 19 there is a new Page
method called fetchCurrentURL
which will actively poll the current url form the frontend.
see: commit
The URI can be retrieved using this:
VaadinServletRequest req = (VaadinServletRequest) VaadinService.getCurrentRequest();
StringBuffer uriString = req.getRequestURL();
URI uri = new URI(uriString.toString());
There is no direct way of doing this, but a feature request is open for this case: https://github.com/vaadin/flow/issues/1897.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With