tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Nuss" <andyn...@siebel.com>
Subject RE: How to obtain user's IP address
Date Thu, 03 May 2001 18:06:35 GMT
You'll need to go to the Javasoft site (Developer Connection) and
search the database for problems related to reverse domain lookups.
For instance, some wierd things have been done w/ RMI for getting
domain (I assume you want user AND domain).

...

I myself used

    String fullUserName = InetAddress.getByName(request.getRemoteAddr()
).getHostName();

because I noticed that getRemoteAddr always works since the address is
right there in the TCP/IP packet.

...

However, the above apis are using InetAddress which in turn
invokes (I believe) the Solaris reverse domain lookup scripts/functions
thru native code.  Please refer to documents on JDC or step thru the above
apis in the debugger (JSwat).


 -----Original Message-----
From: Steven Parks [mailto:Steven_Parks@epicdata.com]
Sent: Thursday, May 03, 2001 8:58 AM
To: tomcat-user@jakarta.apache.org
Subject: RE: How to obtain user's IP address


The name of the 'user' would be dependent on the machine which called the
servlet.  Where did you get request.getRemoteUser()??
There is a getRemoteHost and getRemoteAddr method to the ServletRequest
class which will return either the host or IP-Address of the calling
machine...
public abstract String getRemoteHost() 
Returns the fully qualified host name of the agent that sent the request.
Same as the CGI variable REMOTE_HOST. 
Never having tried it myself, cannot say if it is reliable under all
browsers or calling contexts.... 
-----Original Message----- 
From: Jack Li [mailto:jli@murraysdiscount.com] 
Sent: Thursday, May 03, 2001 7:35 AM 
To: tomcat-user@jakarta.apache.org 
Subject: How to obtain user's IP address 


Hello, 
I need to know who visits my web page. In jsp, I got "null" when I used 
"request.getRemoteUser()". Then any other mehods can obtain user's name or 
IP address? 
Thanks 
Jack Li 


Mime
View raw message