axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Jordahl <t...@macromedia.com>
Subject RE: getting request hostname/IP
Date Mon, 10 Jun 2002 07:56:25 GMT

Yes, that actually is close.
But what I really want is to reflect back in the WSDL the address or hostname (and it could
be either) that was used by the request.

But failing that, we should probably just set the value to the local host IP address.
This may be trouble on machines with more than 1 IP address however....

--
Tom Jordahl
Macromedia


-----Original Message-----
From: Davanum Srinivas [mailto:dims@yahoo.com]
Sent: Saturday, June 08, 2002 12:35 AM
To: axis-dev@xml.apache.org
Subject: Re: cvs commit:
xml-axis/java/src/org/apache/axis/transport/http SimpleAxisWorker.java


Tom,

Is this what u are looking for?

Thanks,
dims

--------------------------------------------------------------------------------
import java.net.*; 
class myAddress { 
  public static void main (String args[]) { 
    try {
      InetAddress address = InetAddress.getLocalHost(); 
      System.out.println("This computer's address = " +address.getHostName());
      System.out.println("This computer's ip = " +address.getHostAddress());
    } catch (UnknownHostException e) {
      System.out.println(
        "Could not find this computer's address.");
    } 
  } 
} 
--------------------------------------------------------------------------------



--- tomj@apache.org wrote:
> tomj        2002/06/07 14:36:30
> 
>   Modified:    java/src/org/apache/axis/transport/http
>                         SimpleAxisWorker.java
>   Log:
>   Fix the broken fix I submitted which sets the hostname used for
>   WSDL locations.  Can't seem to get the ip address and/or hostname
>   that I need so put back the hardwired 'localhost'.  This is broken, but
>   for what we use SimpleAxisServer for, it is sufficient.
>   
>   Revision  Changes    Path
>   1.2       +9 -1      xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisWorker.java
>   
>   Index: SimpleAxisWorker.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisWorker.java,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- SimpleAxisWorker.java	7 Jun 2002 18:31:58 -0000	1.1
>   +++ SimpleAxisWorker.java	7 Jun 2002 21:36:30 -0000	1.2
>   @@ -268,7 +268,15 @@
>                    msgContext.setProperty(Constants.MC_JWS_CLASSDIR,
>                            "jwsClasses");
>    
>   -                String hostname = socket.getInetAddress().getHostName();
>   +                // FIXME
>   +                // This doesn't return anything but 0.0.0.0
>   +                //  String hostname = serverSocket.getInetAddress().getHostAddress();
>   +                // And this returns the hostname of the host on the other
>   +                // end of the socket:
>   +                //  String hostname = socket.getInetAddress().getHostName();
>   +                // This works for 99% of the uses of SimpleAxisServer,
>   +                // but is very stupid
>   +                String hostname = "localhost";
>                    // !!! Fix string concatenation
>                    String url = "http://" + hostname + ":" +
>                            server.getServerSocket().getLocalPort() + "/" +
>   
>   
>   


=====
Davanum Srinivas - http://xml.apache.org/~dims/

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Mime
View raw message