tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Turner, John" <JTur...@AAS.com>
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
do.

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 google...my
guess is the SAMBA group has written one (http://www.samba.org) but it may
not be generally available.

John Turner
jturner@NOSPAM.aas.com

-----Original Message-----
From: Jose Francisco Junior [mailto:jjunior@zipmail.com]
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:

if(
 request.getRequestURL().toString().equals("192.168.20.10")
 ) 
 out.print("show IP content"); 
else 
 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,
Junior



On Fri, 9 Aug 2002 13:50:59 -0400 
"Turner, John" <JTurner@AAS.com> wrote:
>
>Come on...RTFM:
>
>java.net.InetAddress.getByName();
>
>Sheesh.
>
>John Turner
>jturner@NOSPAM.aas.com
>
>
>-----Original Message-----
>From: Jose Francisco Junior [mailto:jjunior@zipmail.com]
>Sent: Friday, August 09, 2002 1:44 PM
>To: Tomcat Users List
>Subject: Re: Configuration for High TPS
>
>
>Please,
>
>I know it is a bit off-topic but I am trying to get a IP
> address from an URL like this:
>new URL("http://java.sun.com"); //this is the URL
>
>How can I get the IP address from this URL? Any idea ??
>
>
>Thanks in advance,
>Junior 
>________________________________________________
>Don't E-Mail, ZipMail! http://www.zipmail.com/
>
>--
>To unsubscribe, e-mail:
><mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
><mailto:tomcat-user-help@jakarta.apache.org>
>
>--
>To unsubscribe, e-mail:
>   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
> <mailto:tomcat-user-help@jakarta.apache.org>
>

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

Willan Brook
-----------------------------------------
________________________________________________
Don't E-Mail, ZipMail! http://www.zipmail.com/

--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message