Play framework : Request_denied when getting json from googlemap url
ok i found this way :
Promise<WS.Response> request =WS.url("http://maps.googleapis.com/maps/api/geocode/json").setQueryParameter("address",adresse).setQueryParameter("sensor", "true").post("content");
Then i parsed it :
String lat = request.get().asJson().path("results").get(0).get("geometry").get("location").get("lat").toString();String long = request.get().asJson().path("results").get(0).get("geometry").get("location").get("lng").toString();
I don't know if it's a "clear" way to do that, but it works fine. :)
I had the same problem with Play 2. After changing the WS.url to the old fashioned way with a HttpUrlConnection it worked. Don't know why the WS.url is not working.
URL theUrl = new URL("http://maps.googleapis.com/maps/api/geocode/json?address=Paris&sensor=false");HttpURLConnection urlConn = (HttpURLConnection) theUrl.openConnection();...