Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 43105 invoked from network); 22 Oct 2008 09:03:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Oct 2008 09:03:40 -0000 Received: (qmail 36615 invoked by uid 500); 22 Oct 2008 09:03:42 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 36501 invoked by uid 500); 22 Oct 2008 09:03:41 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 36492 invoked by uid 500); 22 Oct 2008 09:03:41 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 36489 invoked by uid 99); 22 Oct 2008 09:03:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Oct 2008 02:03:41 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Oct 2008 09:02:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8BF782388879; Wed, 22 Oct 2008 02:02:48 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: axis2-cvs@ws.apache.org From: nandana@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081022090248.8BF782388879@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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;