aspose file tools*
The moose likes JSP and the fly likes Client Location Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Client Location" Watch "Client Location" New topic
Author

Client Location

Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
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.


Thanks,
Prabhat
SCJP 1.5, SCWCD 1.5, SCBCD 1.5
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
Use the HTTP request header - "Accept-Language"


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
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
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

You'll have to ask them.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
Does this mean this is not possible ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Not possible.
Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
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

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Aug 13, 2007
Posts: 58
Thank You for helping me out and explaining things so nicely
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Client Location