I don't know if there's a simpler way, but you can get the IP address of the remote host (from the request headers), then make use of an online resource for looking up information on the IP address. I don't know of any such service off-hand, but you should be able to Google and find something.
Aryan The Bad Boy wrote:How to detect the territory of a request in Struts?
Is there any way to detect that this request is from US or india or any other country or territory ?
the complete way to do it is by using the remote user's IP address against a local or remote database
to get your own IP database that can differentiate countries based on IP, you can get a free GEO database at maxwind.com. To go beyond country, then you pay big money.
A remote service like Mark suggests will of course be easier and be able to tell you India vs United states.
Another way is to get the accept-charset and accept-language headers out of the request object and infer things from there. The request has a getLocale() method that uses the accept-language header to return the preferred locale. I don't know what the default language setting for India is. Obviously, this depends on the user's browser settings and they can easily change this.
you can also calculate the difference in hours between remote user's local time and GMT using Java Script
subject: How to detect the territory of a request ?