Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Client Location  RSS feed

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my application the server needs the location of client.
For e.g if a client say "A" is accessing the website from say a place "B" then the server needs this information.
This location should be the exact location and not the country from where the client is accessing.

Kindly let me know how to achieve this.
 
Ranch Hand
Posts: 893
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the HTTP request header - "Accept-Language"
 
Prabhat Jha
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need the location for e.g if the user is in say "Detroit" then i need the place of client as "Detroit" when the user moves to "Troy" i need the place of client as "Troy".

Thanks
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you'll be able to do this with much reliability.

The best you could do is use their IP (request.getRemoteAddr()) to try to look up the location. There are/were some public databases that attempted to keep track of IP numbers and their latitude and longitude but I don't think there is a formal system for keeping them up to date though.

Also, getRemoteAddr isn't necessarily going to get you the actual IP of the user. They may be running though a proxy or VPN in another city, state, or country altogether.
 
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to ask them.
 
Prabhat Jha
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this mean this is not possible ?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not possible.
 
Prabhat Jha
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A big Thank You to all for there response

After doing googling for quite some time it seems like in order to do this i may have to integrate my application with some GPS Providers.

Is anyone having experience in integrating Web Application with GPS?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you're going to find very many desktop computers with GPS receivers in them.

In any case the work for this wouldn't happen on the web server.
It would happen in the client.
Lookup JSR-179, the API that cell phones and other handheld devices expose to Java developers.

Bear's last post in this thread is probably your best answer.
[ March 12, 2008: Message edited by: Ben Souther ]
 
Prabhat Jha
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You for helping me out and explaining things so nicely
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!