Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HttpServletRequest.getRemoteHost() not working

96 views
Skip to first unread message

Spud

unread,
Oct 22, 2010, 4:14:01 PM10/22/10
to
I've got an app server (Jetty) which processes incoming http requests.
The getRemoteHost() method on HttpServletRequest is supposed to return
the name of the remote host. Instead, it just returns the IP address. I
assume the way it works internally is that it does some kind of reverse
dns lookup, but it's not working here.

In one test case, when I look at the actual IP address it returns and do
a tracert on it, I get the actual hostname, so I know it's available.

Have I configured something wrong on the server or in the JVM?

Mike Schilling

unread,
Oct 22, 2010, 10:18:22 PM10/22/10
to

"Spud" <fa...@fkfkfkf.com> wrote in message
news:Q6qdnQeVlcM...@giganews.com...


The Javadoc says:

If the engine cannot or chooses not to resolve the hostname (to improve
performance), this method
returns the dotted-string form of the IP address.

Thus, it might just be how Jetty implements that method. Have a look at the
source code.

0 new messages