Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting the country city state of the from where the request was made  RSS feed

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there anyway we can get the origin of the request...

I need to get the city, State and Country from which the request was made.

Regards,
Jigar Naik
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Get the client's IP address using HttpServletRequest#getRemoteAddr() and use some geo location API to get the exact geo location based on the IP address. Google can find these API's, both freeware and payware.

That said, do not let your code depend too much on it. It's funny for statistics and some presentional features, but really not more than that. The IP address can easily be spoofed/hidden by the client.
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okey.. thanks a lot Bauke...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!