Howdy,
You can convert IP to host name yourself.  Here's the relevant section
of the code:

String ipAddress = "123.456.789.123";
InetAddress ia = InetAddress.getByName(ipAddress);
String hostname = ia.getHostName();

As you will by experimenting, the above has the desirable property of
working whether ipAddress is nnn.nnn.nnn.nnn or the host name.  So you
can pass whatever you get from getRemoteHost() through this.

The assumption you mention (the fully qualified name is available to the
Solaris the server is running on) is important.  The above will throw an
UnkownHostException if the assumption is broken.

Good luck,

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, July 18, 2002 11:18 AM
>To: [EMAIL PROTECTED]
>Subject: getRemoteHost(): how to get the fully qualified name?
>
>Hi all
>
>When I call the ServletRequest's getRemoteHost()-method, I get
sometimes
>the
>fully quialified name and sometimes the IP of the remote host. This is
the
>case also, if the fully qualified name is aviable to the Solaris the
server
>is running on (using nslookup). Now, is there a way to force the
>Servlet-Engine to deliver the fully qualified name instead of the IP
all
>the
>times?
>
>Thanks for any help.
>Philipp

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to