2

I use java and vaadin

I do window.getURL() and it returns me, for example - 99.22.22.22:8080/2/ However, it's supposed to return app.server.com/2/

of course, app.server.com is the same as 99.22.22.22:8080

But how I can replace it by app.server.com??

mkierc
  • 1,193
  • 2
  • 15
  • 28
vlcod
  • 229
  • 2
  • 3
  • 13

1 Answers1

0

Here is the answer How to get the Vaadin 7 application server IP and port? i guess.

Please try this:

System.out.println(UI.getCurrent().getPage().getLocation().getHost());
System.out.println(UI.getCurrent().getPage().getLocation().getPath());
System.out.println(UI.getCurrent().getPage().getLocation().getPort());

Or get hostname by ip:

InetAddress addr = InetAddress.getByName("99.22.22.22");
String host = addr.getHostName();
System.out.println(host);
Community
  • 1
  • 1