How to get the IP Address of the browser using Vaadin ?

I am currently developing an application using Vaadin 7 where I need to get the IP address of the bowser. I tried to get the address using this line :-
. But its returning a value something like this :- 0:0:0:0:0:0:0:1 .
I want to get the proper IP address of my machine.

Please someone help me with this,


Try: final WebBrowser webBrowser = UI.getCurrent().getSession().getBrowser(); System.out.println(webBrowser.getAddress());//Prints out the IP in the console Similar to this:
Vaadin Sampler Browser Information

Theres nothing wrong with this Address. Its IPV6 only. Probably you are connecting to your application with “localhost/myapp”, and many OS Setups creates alias for localhost as IPV6 address associated with your loopback interface. Please, check that.

Also note that you might have to look at some headers to find the address, specially when you have an Apache front-end.
You’ll have to parse the strings though. it might contain Hostname , ipv4 or ipv6 addresses.

    protected java.util.List<String> getRemoteAddresses(final HttpServletRequest request) {
        final java.util.Set<String> addressList = new java.util.HashSet<String>(); 

        for (final java.util.Enumeration vias = request.getHeaders("Via"); vias.hasMoreElements();) {
            addressList.add((String) vias.nextElement());
        for (final java.util.Enumeration vias = request.getHeaders("x-forwarded-for"); vias.hasMoreElements();) {
            addressList.add((String) vias.nextElement());
        return new java.util.ArrayList<String>(addressList);