Author: gnodet
Date: Tue Sep  5 08:03:25 2006
New Revision: 440367

URL: http://svn.apache.org/viewvc?view=rev&rev=440367
Log:
Display host name when 0.0.0.0 is used

Modified:
    
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java

Modified: 
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java
URL: 
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java?view=diff&rev=440367&r1=440366&r2=440367
==============================================================================
--- 
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java
 (original)
+++ 
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JettyContextManager.java
 Tue Sep  5 08:03:25 2006
@@ -18,7 +18,9 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.net.InetAddress;
 import java.net.URL;
+import java.net.UnknownHostException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -222,7 +224,15 @@
     }
     
     protected String getKey(URL url) {
-        String key = url.getProtocol() + "://" + url.getHost() + ":" + 
url.getPort();
+        String host = url.getHost();
+        try {
+            InetAddress addr = InetAddress.getByName(host);
+            if (addr.isAnyLocalAddress()) {
+                host = InetAddress.getLocalHost().getHostName();
+            }
+        } catch (UnknownHostException e) {
+        }
+        String key = url.getProtocol() + "://" + host + ":" + url.getPort();
         return key;
     }
     


Reply via email to