axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r500028 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
Date Thu, 25 Jan 2007 22:38:19 GMT
Author: dims
Date: Thu Jan 25 14:38:19 2007
New Revision: 500028

URL: http://svn.apache.org/viewvc?view=rev&rev=500028
Log:
Fix for AXIS2-2023 - Generation of soap:address in wsdl files

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=500028&r1=500027&r2=500028
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
Thu Jan 25 14:38:19 2007
@@ -20,6 +20,7 @@
 import java.io.OutputStream;
 import java.util.HashMap;
 import java.util.Map;
+import java.net.URI;
 
 import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
 import org.apache.axis2.AxisFault;
@@ -117,7 +118,7 @@
                 HashMap services = configurationContext.getAxisConfiguration().getServices();
                 final AxisService service = (AxisService) services.get(serviceName);
                 if (service != null) {
-                    final String ip = HttpUtils.getIpAddress();
+                    final String ip = getHostAddress(request);
                     EntityTemplate entity = new EntityTemplate(new ContentProducer() {
 
                         public void writeTo(final OutputStream outstream) throws IOException
{
@@ -136,7 +137,7 @@
                 HashMap services = configurationContext.getAxisConfiguration().getServices();
                 final AxisService service = (AxisService) services.get(serviceName);
                 if (service != null) {
-                    final String ip = HttpUtils.getIpAddress();
+                    final String ip = getHostAddress(request);
                     EntityTemplate entity = new EntityTemplate(new ContentProducer() {
 
                         public void writeTo(final OutputStream outstream) throws IOException
{
@@ -290,6 +291,19 @@
             response.setStatusLine(new StatusLine(ver, 202, "OK"));
         }
     }
+	
+    public String getHostAddress(HttpRequest request) throws java.net.SocketException{
+        try {
+            Header hostHeader = request.getFirstHeader("host");
+            if (hostHeader!=null){
+                String host = hostHeader.getValue();
+                return new URI("http://"+host).getHost();
+            }
+        } catch (Exception e){
+            
+        }
+        return HttpUtils.getIpAddress();
+    }	
 
     class SimpleHTTPRequestResponseTransport implements RequestResponseTransport
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message