Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between request.getRemoteHost() and request.getRemoteAddr()

 
mohanasundaram muthukannan
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i need difference between request.getRemoteHost() and request.getRemoteAddr() in jsp?

any one can explain this one?

Regards,
Mohan.M
 
Vijitha Kumara
Bartender
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need difference between request.getRemoteHost() and request.getRemoteAddr()

Is this related to this post ?

Well, getRemoteHost() returns the fully qualified name of the client or the last proxy that sent the request and getRemoteAddr() returns the IP address of the client or the last proxy that sent the request.


 
Vijitha Kumara
Bartender
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BTW, check the Servlet Spec for complete details.
 
Kenny Kuriakose
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

request.getRemoteAddr() returns the IP address of the comp whereas request.getRemoteHost() tries to retireve the host name. If host name is empty, then it tries to retrieve the IP address, just like how getRemoteAddr() works.

Thanks,
Kenny Kuriakose
SCJP, SCWCD, SCBCD, SCEA-part 1
 
mohanasundaram muthukannan
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kenny Kuriakose



Regards,
Mohan.M
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java classes, methods and fields are usually explained in detail in the API documents.
I highly recommend you to familarize yourself with finding, reading and understanding the API docs.

Here's the API doc of HttpServletRequest: http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletRequest.html
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic