I wrote this Hello World version of testing out the header. See if it works for you and let me know if it does not. The code is as simple as this:
request.getHeader("X-AppEngine-Country")
request.getHeader("X-AppEngine-Region")
request.getHeader("X-AppEngine-City")
request.getHeader("X-AppEngine-CityLatLong")
Let us check all the other headers:
| Header Name | Header Value |
| x-cc-id | ccc02-02 |
| Host | mylocationtest.appspot.com |
| Accept | text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 |
| Accept-Language | en-us,en;q=0.5 |
| Accept-Charset | ISO-8859-1,utf-8;q=0.7,*;q=0.7 |
| Cache-Control | no-cache |
| Pragma | no-cache |
| User-Agent | CCBot/1.0 (+http://www.commoncrawl.org/bot.html) |
| X-AppEngine-Country | US |
| X-AppEngine-Region | ca |
| X-AppEngine-City | covina |
| X-AppEngine-CityLatLong | 34.090009,-117.890339 |
If you believe that the country,region,city,lat,long detected is wrong, please let me know in the comments.
For more information on Google App Engine, check out some other articles.