WebBrowser::getAddress
In Vaadin Flow, use the class WebBrowser::getAddress
to get the user's IP address.
To get a WebBrowser
object, ask the current VaadinSession
object.
String ipAddress = VaadinSession.getCurrent().getBrowser().getAddress() ;
The WebBrowser
object also holds information about the client’s browser kind and version, their current default Locale
, host OS, browser’s ability to handle modern Vaadin Flow web apps, and more.
By the way, in Vaadin 14 you can run snippets of JavaScript on the client. So that might be a way to obtain even more details about the browser and host of your client user. And coming in Vaadin 15 is greatly enhanced support for executing in JavaScript on the client while maintaining communications with the Vaadin Flow Java runtime on the server.