axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nand...@apache.org
Subject svn commit: r706907 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java
Date Wed, 22 Oct 2008 09:02:48 GMT
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;



Mime
View raw message