This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Need Help getting Referrer IP in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Need Help getting Referrer IP in Servlet" Watch "Need Help getting Referrer IP in Servlet" New topic
Author

Need Help getting Referrer IP in Servlet

Randall Stevens
Ranch Hand

Joined: Jul 01, 2003
Posts: 65
I have a situation where an Access Controller is redirecting the request to my server. The question I have is how do I retreive the IP address of the Access Controller?
brief code examples would be appreciated, as it has been a long time since I have worked with Servlets and JSPs.
Randall
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I'm assuming you're retrieving the IP address of the Controller, while you are in the responding servlet (the application the Controller redirects to).

For the originating server, you use request.getRemoteHost() and request.getRemoteAddr()

FWIW: I'm not actually sure of how to retrieve the IP address of the responding server, but you get the hostname of the responding server with request.getServerName()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help getting Referrer IP in Servlet
 
Similar Threads
How can you restrict unauthorised ip address accessing your site?
Which protocol to use?
Inner classes and Mediator Pattern
Unable to access tomcat via public ip
Applet accessing client's file system