REST base url gets complete complete domain name jmx-rest-api
authorhb
Tue, 02 Jan 2018 15:03:52 +0530
branchjmx-rest-api
changeset 56005 90cff2ac77b8
parent 56004 da55d1429860
child 56006 352a4f213fc6
REST base url gets complete complete domain name
src/java.management.rest/share/classes/javax/management/remote/rest/PlatformRestAdapter.java
--- a/src/java.management.rest/share/classes/javax/management/remote/rest/PlatformRestAdapter.java	Tue Jan 02 13:33:08 2018 +0530
+++ b/src/java.management.rest/share/classes/javax/management/remote/rest/PlatformRestAdapter.java	Tue Jan 02 15:03:52 2018 +0530
@@ -271,9 +271,9 @@
         }
         try {
             if (httpServer instanceof HttpsServer) {
-                return "https://" + InetAddress.getLocalHost().getHostName() + ":" + httpServer.getAddress().getPort();
+                return "https://" + InetAddress.getLocalHost().getCanonicalHostName() + ":" + httpServer.getAddress().getPort();
             }
-            return "http://" + InetAddress.getLocalHost().getHostName() + ":" + httpServer.getAddress().getPort();
+            return "http://" + InetAddress.getLocalHost().getCanonicalHostName() + ":" + httpServer.getAddress().getPort();
         } catch (UnknownHostException ex) {
             return "http://localhost" + ":" + httpServer.getAddress().getPort();
         }