tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Turner, John" <>
Subject RE: Converting HOST to IP an IP to HOST
Date Fri, 09 Aug 2002 19:21:52 GMT

Well, so far you've asked two different questions, yet they are supposed to
be the same.

Your first post wanted an IP address from a name, getByName() will do that
for you, assuming by "name" you mean fully-qualified internet domain name.  

Now you are saying that the IP address will actually be in the URL, in which
case you don't need to look it up, so it's not clear what you are trying to

If you need to differentiate content based on whether someone accesses a
resource by IP address or name, and there are many possible IP addresses,
then all you have to do is test if the value returned from getRequestURI()
has an IP address in it.  So rather than look for a specific IP address, all
you have to do is look for ANY IP address.  That will tell you if someone
entered the machine name or not.  

If you need something to translate a Microsoft WINS name (server name) to an
IP address, you'll need some sort of Java WINS library...check
guess is the SAMBA group has written one ( but it may
not be generally available.

John Turner

-----Original Message-----
From: Jose Francisco Junior []
Sent: Friday, August 09, 2002 2:55 PM
To: Tomcat Users List
Subject: Converting HOST to IP an IP to HOST

All right, but it does not solve my problem. I did a local
 web system that can be accessed both by IP or HOST.
 Depending on the way the user accessed( by HOST or IP )
 the application I must display different contents. 

I could do this:

 out.print("show IP content"); 
 ou.print("show HOST content");

But the web server has many network devices and the user
 can accesss the system from many other IP and HOSTs.

The InetAddress.getByName() does not work with the machine
 network name only with inet hosts.

Does anybody has any idea ???

Thanks in advice,

On Fri, 9 Aug 2002 13:50:59 -0400 
"Turner, John" <> wrote:
>Come on...RTFM:
>John Turner
>-----Original Message-----
>From: Jose Francisco Junior []
>Sent: Friday, August 09, 2002 1:44 PM
>To: Tomcat Users List
>Subject: Re: Configuration for High TPS
>I know it is a bit off-topic but I am trying to get a IP
> address from an URL like this:
>new URL(""); //this is the URL
>How can I get the IP address from this URL? Any idea ??
>Thanks in advance,
>Don't E-Mail, ZipMail!
>To unsubscribe, e-mail:
>For additional commands, e-mail:
>To unsubscribe, e-mail:
>   <>
>For additional commands, e-mail:
> <>

Prefiro as lágrimas da derrota
do que a vergonha de não ter lutado... 

Willan Brook
Don't E-Mail, ZipMail!

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message