You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2008/10/22 11:02:48 UTC

svn commit: r706907 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java

Author: nandana
Date: Wed Oct 22 02:02:47 2008
New Revision: 706907

URL: http://svn.apache.org/viewvc?rev=706907&view=rev
Log:
AXIS2-3784 a utility method to get the hostname parameter 

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java?rev=706907&r1=706906&r2=706907&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java Wed Oct 22 02:02:47 2008
@@ -612,6 +612,25 @@
         }
         return getIpAddress();
     }
+    
+    /**
+     * First check whether the hostname parameter is there in AxisConfiguration (axis2.xml) ,
+     * if it is there then this will return that as the host name , o.w will return the IP address.
+     * @param axisConfiguration
+     * @return hostname 
+     */
+    public static String getHostname(AxisConfiguration axisConfiguration) {
+        if(axisConfiguration!=null){
+            Parameter param = axisConfiguration.getParameter(TransportListener.HOST_ADDRESS);
+            if (param != null) {
+                String  hostAddress = ((String) param.getValue()).trim();
+                if(hostAddress!=null){
+                    return hostAddress;
+                }
+            }
+        }      
+        return null;
+    }
 
     private static boolean isIP(String hostAddress) {
         return hostAddress.split("[.]").length == 4;