Is there any way to get the client name and, may be, other client infos (browser type etc…) in my application?
Tks
Tullio
I would recommend to check methods provided by WebBrowser class for this purpose.
https://vaadin.com/api/7.5.1/com/vaadin/server/WebBrowser.html
There are lot of old example codes hanging out there. From Vaadin 7 onwards the proper way to instantiate WebBrowser object is the following.
WebBrowser browser = Page.getCurrent().getWebBrowser();
Tks but it didn’t solve my problem.
First it doesn’t provide the remote client name and the IP address is not a solution because very often is not stable in the time.
Second I need it in the UI init process and, at that moment, Page.getCurrent() is null.
Tks
Are you writing a portlet? I think WebBrowser object is not working very well then, since in that case Page.getCurrent() returns null. In normal Servlet Page.getCurrent() should have a value in init method and you can get e.g. IP address as string of the client using browser.getAddress() etc.
Also:
If by Remote Client name you mean the name of the PC or the OS: Theses informations won’t usually get send by the Browser for security reasons. So there is no way to get these informations other than asking the user to type them in and connecting them to an account or something.
Im get a computer name in following way:
InetAddress.getByName(getUI().getPage().getWebBrowser().getAddress()).getCanonicalHostName()