Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Detecting a clients hostname in Tomcat 4  RSS feed

 
Daniel Sutherland
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been detecting client hostnames under JDK 1.3 and Tomcat 3.1 using HTTP Servlets for some time now using the folliwing code:-
InetAddress add = InetAddress.getByName(req.getRemoteHost());
It normally would provide something like such:- client.something.com/192.168.0.1
However when I upgraded my JDK to 1.4 and my web server to Tomcat 4....It does not provide the hostname anymore, only the IP address of the client. I have tried all sorts of variations. But to no success as yet.
I think it may have something to do with the security manager. But I'm not sure how to tackle the problem. Can anyone shed any light on this?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe there is a setting in Tomcat 4 server.xml that controls whether or not the lookup is performed. The attribute enableLookups in the Connector tag is "false" by default. This was done to improve response speed.
Bill
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved from Servlets -> Apache/Tomcat
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!