[ 
https://issues.apache.org/jira/browse/CAMEL-12554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16538130#comment-16538130
 ] 

ASF GitHub Bot commented on CAMEL-12554:
----------------------------------------

onderson closed pull request #2415: CAMEL-12554 - camel-geocoder - Use new API
URL: https://github.com/apache/camel/pull/2415
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/components/camel-geocoder/pom.xml 
b/components/camel-geocoder/pom.xml
index 9243244f2a6..7a414a3f693 100644
--- a/components/camel-geocoder/pom.xml
+++ b/components/camel-geocoder/pom.xml
@@ -42,17 +42,12 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
     </dependency>
+    <!-- Java client library for Google Maps API Web Services -->
     <dependency>
-      <groupId>com.google.code.geocoder-java</groupId>
-      <artifactId>geocoder-java</artifactId>
-      <version>${geocoder-java-version}</version>
+      <groupId>com.google.maps</groupId>
+      <artifactId>google-maps-services</artifactId>
+      <version>${google-maps-services-version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-mapper-asl</artifactId>
-      <version>${jackson-version}</version>
-    </dependency>
-
     <!-- testing -->
     <dependency>
       <groupId>org.apache.camel</groupId>
diff --git a/components/camel-geocoder/src/main/docs/geocoder-component.adoc 
b/components/camel-geocoder/src/main/docs/geocoder-component.adoc
index a49ba5b14f6..e0d2b00279f 100644
--- a/components/camel-geocoder/src/main/docs/geocoder-component.adoc
+++ b/components/camel-geocoder/src/main/docs/geocoder-component.adoc
@@ -65,16 +65,13 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *clientId* (producer) | To use google premium with this client id |  | String
-| *clientKey* (producer) | To use google premium with this client key |  | 
String
+| *apiKey* (producer) | Google Maps API Key |  | String
+| *clientId* (producer) | Client Id for Google Maps API Premium Plan |  | 
String
+| *clientKey* (producer) | Private key for Google Maps API Premium Plan |  | 
String
 | *headersOnly* (producer) | Whether to only enrich the Exchange with headers, 
and leave the body as-is. | false | boolean
-| *language* (producer) | The language to use. | en | String
-| *httpClientConfigurer* (advanced) | Register a custom configuration strategy 
for new HttpClient instances created by producers or consumers such as to 
configure authentication mechanisms etc |  | HttpClientConfigurer
-| *httpConnectionManager* (advanced) | To use a custom HttpConnectionManager 
to manage connections |  | HttpConnectionManager
+| *language* (producer) | The language in which to return results. | en | 
String
 | *synchronous* (advanced) | Sets whether synchronous processing should be 
strictly used, or Camel is allowed to use asynchronous processing (if 
supported). | false | boolean
-| *proxyAuthDomain* (proxy) | Domain for proxy NTML authentication |  | String
-| *proxyAuthHost* (proxy) | Optional host for proxy NTML authentication |  | 
String
-| *proxyAuthMethod* (proxy) | Authentication method for proxy, either as 
Basic, Digest or NTLM. |  | String
+| *proxyAuthMethod* (proxy) | Authentication method for proxy, either as Basic 
or Digest. |  | String
 | *proxyAuthPassword* (proxy) | Password for proxy authentication |  | String
 | *proxyAuthUsername* (proxy) | Username for proxy authentication |  | String
 | *proxyHost* (proxy) | The proxy host name |  | String
@@ -121,6 +118,8 @@ Exchange.
 |`CamelGeoCoderCountryLong` |The country long name.
 
 |`CamelGeoCoderCountryShort` |The country short name.
+
+|`CamelGeoCoderPostalCode` |The postal code.
 |=======================================================================
 
 Notice not all headers may be provided depending on available data and
diff --git 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderConstants.java
 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderConstants.java
index 58b76122bc2..afe0bf58001 100644
--- 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderConstants.java
+++ 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderConstants.java
@@ -28,6 +28,7 @@
     public static final String CITY = "CamelGeoCoderCity";
     public static final String COUNTRY_LONG = "CamelGeoCoderCountryLong";
     public static final String COUNTRY_SHORT = "CamelGeoCoderCountryShort";
+    public static final String POSTAL_CODE = "CamelGeoCoderPostalCode";
 
     private GeoCoderConstants() {
     }
diff --git 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderEndpoint.java
 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderEndpoint.java
index 0a7b047d9e2..c1e45952908 100644
--- 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderEndpoint.java
+++ 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderEndpoint.java
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,25 +16,18 @@
  */
 package org.apache.camel.component.geocoder;
 
-import java.security.InvalidKeyException;
-
-import com.google.code.geocoder.AdvancedGeoCoder;
-import com.google.code.geocoder.Geocoder;
+import com.google.maps.GeoApiContext;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import 
org.apache.camel.component.geocoder.http.AuthenticationHttpClientConfigurer;
 import org.apache.camel.component.geocoder.http.AuthenticationMethod;
-import org.apache.camel.component.geocoder.http.CompositeHttpConfigurer;
-import org.apache.camel.component.geocoder.http.HttpClientConfigurer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpConnectionManager;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+
+import java.net.InetSocketAddress;
+import java.net.Proxy;
 
 /**
  * The geocoder component is used for looking up geocodes (latitude and 
longitude) for a given address, or reverse lookup.
@@ -48,10 +41,12 @@
     private String latlng;
     @UriParam(defaultValue = "en")
     private String language = "en";
-    @UriParam
+    @UriParam(label = "security", secret = true)
     private String clientId;
-    @UriParam
+    @UriParam(label = "security", secret = true)
     private String clientKey;
+    @UriParam(label = "security", secret = true)
+    private String apiKey;
     @UriParam
     private boolean headersOnly;
     @UriParam(label = "proxy")
@@ -68,10 +63,6 @@
     private String proxyAuthDomain;
     @UriParam(label = "proxy")
     private String proxyAuthHost;
-    @UriParam(label = "advanced")
-    private HttpClientConfigurer httpClientConfigurer;
-    @UriParam(label = "advanced")
-    private HttpConnectionManager httpConnectionManager;
 
     public GeoCoderEndpoint() {
     }
@@ -158,6 +149,15 @@ public void setClientKey(String clientKey) {
         this.clientKey = clientKey;
     }
 
+
+    private String getApiKey() {
+        return apiKey;
+    }
+
+    public void setApiKey(String apiKey) {
+        this.apiKey = apiKey;
+    }
+
     /**
      * The proxy host name
      */
@@ -232,101 +232,42 @@ public void setProxyAuthHost(String proxyAuthHost) {
         this.proxyAuthHost = proxyAuthHost;
     }
 
-    public HttpClientConfigurer getHttpClientConfigurer() {
-        return httpClientConfigurer;
-    }
-
-    /**
-     * Register a custom configuration strategy for new {@link HttpClient} 
instances
-     * created by producers or consumers such as to configure authentication 
mechanisms etc
-     *
-     * @param httpClientConfigurer the strategy for configuring new {@link 
HttpClient} instances
-     */
-    public void setHttpClientConfigurer(HttpClientConfigurer 
httpClientConfigurer) {
-        this.httpClientConfigurer = httpClientConfigurer;
-    }
-
-    public HttpConnectionManager getHttpConnectionManager() {
-        return httpConnectionManager;
-    }
-
-    /**
-     * To use a custom HttpConnectionManager to manage connections
-     */
-    public void setHttpConnectionManager(HttpConnectionManager 
httpConnectionManager) {
-        this.httpConnectionManager = httpConnectionManager;
-    }
-
-    Geocoder createGeocoder() throws InvalidKeyException {
-        HttpConnectionManager connectionManager = this.httpConnectionManager;
-        if (connectionManager == null) {
-            connectionManager = new MultiThreadedHttpConnectionManager();
-        }
-
-        HttpClient httpClient = new HttpClient(connectionManager);
-        if (proxyHost != null && proxyPort != null) {
-            httpClient.getHostConfiguration().setProxy(proxyHost, proxyPort);
-        }
-
-        // validate that if proxy auth username is given then the proxy auth 
method is also provided
-        if (proxyAuthUsername != null && proxyAuthMethod == null) {
-            throw new IllegalArgumentException("Option proxyAuthMethod must be 
provided to use proxy authentication");
-        }
-
-        CompositeHttpConfigurer configurer = new CompositeHttpConfigurer();
-        if (proxyAuthMethod != null) {
-            configureProxyAuth(configurer, proxyAuthMethod, proxyAuthUsername, 
proxyAuthPassword, proxyAuthDomain, proxyAuthHost);
-        }
-        if (httpClientConfigurer != null) {
-            configurer.addConfigurer(httpClientConfigurer);
-        }
-
-        configurer.configureHttpClient(httpClient);
-
-        Geocoder geocoder;
+    GeoApiContext createGeoApiContext() {
+        GeoApiContext.Builder builder = new GeoApiContext.Builder();
         if (clientId != null) {
-            geocoder = new AdvancedGeoCoder(httpClient, clientId, clientKey);
+            builder = builder.enterpriseCredentials(clientId, clientKey);
         } else {
-            geocoder = new AdvancedGeoCoder(httpClient);
+            builder = builder.apiKey(getApiKey());
         }
-
-        return geocoder;
+        if (isProxyDefined()) {
+            builder = builder.proxy(createProxy());
+            if (isProxyAuthDefined()) {
+                builder = configureProxyAuth(builder);
+            }
+        }
+        return builder.build();
     }
 
-    /**
-     * Configures the proxy authentication method to be used
-     *
-     * @return configurer to used
-     */
-    protected CompositeHttpConfigurer 
configureProxyAuth(CompositeHttpConfigurer configurer,
-            String authMethod, String username, String password, String 
domain, String host) {
-
-        // no proxy auth is in use
-        if (username == null && authMethod == null) {
-            return configurer;
+    private GeoApiContext.Builder configureProxyAuth(GeoApiContext.Builder 
builder) {
+        AuthenticationMethod auth = 
getCamelContext().getTypeConverter().convertTo(AuthenticationMethod.class, 
proxyAuthMethod);
+        if (auth == AuthenticationMethod.Basic || auth == 
AuthenticationMethod.Digest) {
+            builder = builder.proxyAuthentication(proxyAuthUsername, 
proxyAuthPassword);
         }
-
-        // validate mandatory options given
-        if (username != null && authMethod == null) {
-            throw new IllegalArgumentException("Option proxyAuthMethod must be 
provided to use proxy authentication");
+        else{
+            throw new IllegalArgumentException("Unknown proxyAuthMethod " + 
proxyAuthMethod);
         }
+        return builder;
+    }
 
-        ObjectHelper.notNull(authMethod, "proxyAuthMethod");
-        ObjectHelper.notNull(username, "proxyAuthUsername");
-        ObjectHelper.notNull(password, "proxyAuthPassword");
-
-        AuthenticationMethod auth = 
getCamelContext().getTypeConverter().convertTo(AuthenticationMethod.class, 
authMethod);
+    private Proxy createProxy() {
+        return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, 
proxyPort));
+    }
 
-        if (auth == AuthenticationMethod.Basic || auth == 
AuthenticationMethod.Digest) {
-            
configurer.addConfigurer(AuthenticationHttpClientConfigurer.basicAutenticationConfigurer(true,
 username, password));
-            return configurer;
-        } else if (auth == AuthenticationMethod.NTLM) {
-            // domain is mandatory for NTML
-            ObjectHelper.notNull(domain, "proxyAuthDomain");
-            
configurer.addConfigurer(AuthenticationHttpClientConfigurer.ntlmAutenticationConfigurer(true,
 username, password, domain, host));
-            return configurer;
-        }
+    private boolean isProxyDefined() {
+        return proxyHost != null && proxyPort != null;
+    }
 
-        throw new IllegalArgumentException("Unknown proxyAuthMethod " + 
authMethod);
+    private boolean isProxyAuthDefined() {
+        return proxyAuthMethod != null;
     }
 }
diff --git 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderProducer.java
 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderProducer.java
index 8e2f4800fe1..049170f6348 100644
--- 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderProducer.java
+++ 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderProducer.java
@@ -16,27 +16,28 @@
  */
 package org.apache.camel.component.geocoder;
 
-import java.math.BigDecimal;
-import java.net.URL;
-
-import com.google.code.geocoder.Geocoder;
-import com.google.code.geocoder.model.GeocodeResponse;
-import com.google.code.geocoder.model.GeocoderAddressComponent;
-import com.google.code.geocoder.model.GeocoderRequest;
-import com.google.code.geocoder.model.GeocoderResult;
-import com.google.code.geocoder.model.GeocoderStatus;
-import com.google.code.geocoder.model.LatLng;
+import java.util.Locale;
+
+import com.google.maps.GeoApiContext;
+import com.google.maps.GeocodingApi;
+import com.google.maps.GeolocationApi;
+import com.google.maps.errors.InvalidRequestException;
+import com.google.maps.errors.OverDailyLimitException;
+import com.google.maps.errors.OverQueryLimitException;
+import com.google.maps.errors.RequestDeniedException;
+import com.google.maps.errors.UnknownErrorException;
+import com.google.maps.model.AddressComponent;
+import com.google.maps.model.AddressType;
+import com.google.maps.model.GeocodingResult;
+import com.google.maps.model.GeolocationPayload;
+import com.google.maps.model.GeolocationResult;
+import com.google.maps.model.LatLng;
 import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.map.ObjectMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.camel.util.ObjectHelper.isEmpty;
-import static org.apache.camel.util.ObjectHelper.notNull;
-
 /**
  * The GeoCoder producer.
  */
@@ -44,7 +45,7 @@
     private static final Logger LOG = 
LoggerFactory.getLogger(GeoCoderProducer.class);
 
     private GeoCoderEndpoint endpoint;
-    private Geocoder geocoder;
+    private GeoApiContext context;
 
     public GeoCoderProducer(GeoCoderEndpoint endpoint) {
         super(endpoint);
@@ -52,152 +53,173 @@ public GeoCoderProducer(GeoCoderEndpoint endpoint) {
     }
 
     public void process(Exchange exchange) throws Exception {
-        // header take precedence
-        String address = exchange.getIn().getHeader(GeoCoderConstants.ADDRESS, 
String.class);
-        if (address == null) {
-            address = endpoint.getAddress();
-        }
+        try {
+            // headers take precedence
+            String address = 
exchange.getIn().getHeader(GeoCoderConstants.ADDRESS, String.class);
+            if (address == null) {
+                address = endpoint.getAddress();
+            }
 
-        String latlng = exchange.getIn().getHeader(GeoCoderConstants.LATLNG, 
String.class);
-        if (latlng == null) {
-            latlng = endpoint.getLatlng();
-        }
+            String latlng = 
exchange.getIn().getHeader(GeoCoderConstants.LATLNG, String.class);
+            if (latlng == null) {
+                latlng = endpoint.getLatlng();
+            }
 
-        if (latlng != null) {
-            GeocoderRequest req = new GeocoderRequest();
-            req.setLanguage(endpoint.getLanguage());
+            if (latlng != null) {
+                String lat = ObjectHelper.before(latlng, ",");
+                String lng = ObjectHelper.after(latlng, ",");
+                LatLng latLng = new LatLng(Double.parseDouble(lat), 
Double.parseDouble(lng));
 
-            String lat = ObjectHelper.before(latlng, ",");
-            String lng = ObjectHelper.after(latlng, ",");
-            req.setLocation(new LatLng(lat, lng));
+                LOG.debug("Geocode for lat/lng {}", latlng);
+                GeocodingResult[] results = 
GeocodingApi.reverseGeocode(context, latLng).await();
 
-            LOG.debug("Geocode for lat/lng {}", latlng);
-            GeocodeResponse res = geocoder.geocode(req);
-            LOG.debug("Geocode response {}", res);
+                LOG.debug("Geocode response {}", results);
 
-            if (res != null) {
-                extractGeoResult(res, exchange);
-            }
-        } else if (address != null) {
-
-            // is it current address
-            if ("current".equals(address)) {
-                processCurrentLocation(exchange);
-            } else {
-                LOG.debug("Geocode for address {}", address);
-                GeocoderRequest req = new GeocoderRequest(address, 
endpoint.getLanguage());
-                GeocodeResponse res = geocoder.geocode(req);
-                LOG.debug("Geocode response {}", res);
-
-                if (res != null) {
-                    extractGeoResult(res, exchange);
+                if (results != null) {
+                    extractGeoResult(results, exchange);
+                }
+
+            } else if (address != null) {
+
+                // is it current address
+                if ("current".equals(address)) {
+                    processCurrentLocation(exchange);
+                } else {
+
+                    LOG.debug("Geocode for address {}", address);
+                    GeocodingResult[] results = GeocodingApi.geocode(context, 
address).await();
+                    LOG.debug("Geocode response {}", results);
+
+                    if (results != null) {
+                        extractGeoResult(results, exchange);
+                    }
                 }
             }
+        } catch (RequestDeniedException e) {
+            exchange.getIn().setHeader(GeoCoderConstants.STATUS, 
GeocoderStatus.REQUEST_DENIED);
+        } catch (OverQueryLimitException e) {
+            exchange.getIn().setHeader(GeoCoderConstants.STATUS, 
GeocoderStatus.OVER_QUERY_LIMIT);
+        } catch (OverDailyLimitException e) {
+            exchange.getIn().setHeader(GeoCoderConstants.STATUS, 
GeocoderStatus.OVER_DAILY_LIMIT);
+        } catch (InvalidRequestException e) {
+            exchange.getIn().setHeader(GeoCoderConstants.STATUS, 
GeocoderStatus.INVALID_REQUEST);
+        } catch (UnknownErrorException e) {
+            exchange.getIn().setHeader(GeoCoderConstants.STATUS, 
GeocoderStatus.UNKNOWN_ERROR);
         }
     }
 
+    /**
+     * Perform geolocation to retrieve LatLng and then perform a geocoding
+     */
     protected void processCurrentLocation(Exchange exchange) throws Exception {
-        LOG.debug("Geocode for current address");
-        String json = 
exchange.getContext().getTypeConverter().mandatoryConvertTo(String.class, new 
URL("https://freegeoip.net/json/";));
-        if (isEmpty(json)) {
-            throw new IllegalStateException("Got the unexpected value '" + 
json + "' for the geolocation");
-        }
-        LOG.debug("Geocode response {}", json);
+        LOG.debug("Geolocation for current location");
+        GeolocationPayload payload = new GeolocationPayload();
+        payload.considerIp = true;
+        GeolocationResult result = GeolocationApi.geolocate(context, 
payload).await();
 
+        LOG.debug("Geolocation response {}", result);
+        //status
         exchange.getIn().setHeader(GeoCoderConstants.STATUS, 
GeocoderStatus.OK);
 
-        ObjectMapper mapper = new ObjectMapper();
-        JsonNode node = mapper.readValue(json, JsonNode.class);
-
-        JsonNode latitudeNode = notNull(node.get("latitude"), "latitude");
-        JsonNode longitudeNode = notNull(node.get("longitude"), "longitude");
-        String resLatlng = latitudeNode.asText() + "," + 
longitudeNode.asText();
+        //latlng
+        String resLatlng = result.location.toString();
         exchange.getIn().setHeader(GeoCoderConstants.LATLNG, resLatlng);
 
-        JsonNode countryCode = node.get("country_code");
-        JsonNode countryName = node.get("country_name");
-        if (countryCode != null) {
-            exchange.getIn().setHeader(GeoCoderConstants.COUNTRY_SHORT, 
countryCode.asText());
-        }
-        if (countryName != null) {
-            exchange.getIn().setHeader(GeoCoderConstants.COUNTRY_LONG, 
countryName.asText());
-        }
+        //address - reverse geocode
+        LOG.debug("Geocode - reverse geocode for location {}", resLatlng);
+        GeocodingResult[] results = GeocodingApi.reverseGeocode(context, 
result.location).await();
 
-        JsonNode regionCode = node.get("region_code");
-        JsonNode regionName = node.get("region_name");
-        if (regionCode != null) {
-            exchange.getIn().setHeader(GeoCoderConstants.REGION_CODE, 
regionCode.asText());
-        }
-        if (regionName != null) {
-            exchange.getIn().setHeader(GeoCoderConstants.REGION_NAME, 
regionName.asText());
-        }
+        LOG.debug("Geocode response {}", results);
 
-        JsonNode city = node.get("city");
-        if (city != null) {
-            exchange.getIn().setHeader(GeoCoderConstants.CITY, city.asText());
+        if (results != null) {
+            extractGeoResult(results, exchange);
         }
+    }
 
-        // should we include body
-        if (!endpoint.isHeadersOnly()) {
-            exchange.getIn().setBody(json);
-        }
+    private void setLatLngToExchangeHeader(LatLng location, Exchange exchange) 
{
+        double resLat = location.lat;
+        double resLng = location.lng;
+        exchange.getIn().setHeader(GeoCoderConstants.LAT, 
formatLatOrLon(resLat));
+        exchange.getIn().setHeader(GeoCoderConstants.LNG, 
formatLatOrLon(resLng));
+        String resLatlng = location.toString();
+        exchange.getIn().setHeader(GeoCoderConstants.LATLNG, resLatlng);
     }
 
-    protected void extractGeoResult(GeocodeResponse res, Exchange exchange) {
-        exchange.getIn().setHeader(GeoCoderConstants.STATUS, res.getStatus());
+    protected void extractGeoResult(GeocodingResult[] res, Exchange exchange) {
         // should we include body
         if (!endpoint.isHeadersOnly()) {
             exchange.getIn().setBody(res);
         }
+        //no results
+        if (res.length == 0) {
+            exchange.getIn().setHeader(GeoCoderConstants.STATUS, 
GeocoderStatus.ZERO_RESULTS);
+            return;
+        }
 
-        if (res.getStatus() == GeocoderStatus.OK) {
-            exchange.getIn().setHeader(GeoCoderConstants.ADDRESS, 
res.getResults().get(0).getFormattedAddress());
-            // just grab the first element and its lat and lon
-            BigDecimal resLat = 
res.getResults().get(0).getGeometry().getLocation().getLat();
-            BigDecimal resLon = 
res.getResults().get(0).getGeometry().getLocation().getLng();
-            exchange.getIn().setHeader(GeoCoderConstants.LAT, 
resLat.toPlainString());
-            exchange.getIn().setHeader(GeoCoderConstants.LNG, 
resLon.toPlainString());
-            String resLatlng = resLat.toPlainString() + "," + 
resLon.toPlainString();
-            exchange.getIn().setHeader(GeoCoderConstants.LATLNG, resLatlng);
-
-            GeocoderAddressComponent country = getCountry(res);
-            if (country != null) {
-                exchange.getIn().setHeader(GeoCoderConstants.COUNTRY_SHORT, 
country.getShortName());
-                exchange.getIn().setHeader(GeoCoderConstants.COUNTRY_LONG, 
country.getLongName());
-            }
+        exchange.getIn().setHeader(GeoCoderConstants.STATUS, 
GeocoderStatus.OK);
 
-            GeocoderAddressComponent city = getCity(res);
-            if (city != null) {
-                exchange.getIn().setHeader(GeoCoderConstants.CITY, 
city.getLongName());
-            }
+        GeocodingResult first = res[0];
+        exchange.getIn().setHeader(GeoCoderConstants.ADDRESS, 
first.formattedAddress);
+        // just grab the first element and its lat and lon
+        setLatLngToExchangeHeader(first.geometry.location, exchange);
+
+        //additional details
+        AddressComponent country = getCountry(res);
+        if (country != null) {
+            exchange.getIn().setHeader(GeoCoderConstants.COUNTRY_SHORT, 
country.shortName);
+            exchange.getIn().setHeader(GeoCoderConstants.COUNTRY_LONG, 
country.longName);
         }
-    }
 
-    private static GeocoderAddressComponent getCountry(GeocodeResponse res) {
-        for (GeocoderResult result : res.getResults()) {
-            for (String type : result.getTypes()) {
-                if ("country".equals(type)) {
-                    return result.getAddressComponents().get(0);
-                }
-            }
+        AddressComponent city = getCity(res);
+        if (city != null) {
+            exchange.getIn().setHeader(GeoCoderConstants.CITY, city.longName);
         }
-        return null;
+
+        AddressComponent postalCode = getPostalCode(res);
+        if (postalCode != null) {
+            exchange.getIn().setHeader(GeoCoderConstants.POSTAL_CODE, 
postalCode.shortName);
+        }
+
+        AddressComponent region = getRegion(res);
+        if (region != null) {
+            exchange.getIn().setHeader(GeoCoderConstants.REGION_CODE, 
region.shortName);
+            exchange.getIn().setHeader(GeoCoderConstants.REGION_NAME, 
region.longName);
+        }
+    }
+
+    private String formatLatOrLon(double value) {
+        return String.format(Locale.ENGLISH, "%.8f", value);
     }
 
-    private static GeocoderAddressComponent getCity(GeocodeResponse res) {
-        for (GeocoderResult result : res.getResults()) {
-            for (String type : result.getTypes()) {
-                if ("locality".equals(type)) {
-                    return result.getAddressComponents().get(0);
+    private static AddressComponent getComponent(GeocodingResult[] results, 
AddressType addressType) {
+        for (GeocodingResult result : results) {
+            for (AddressType type : result.types) {
+                if (type == addressType && result.addressComponents.length > 
0) {
+                    return result.addressComponents[0];
                 }
             }
         }
         return null;
     }
 
-    @Override
-    protected void doStart() throws Exception {
-        geocoder = endpoint.createGeocoder();
+    private static AddressComponent getCountry(GeocodingResult[] res) {
+        return getComponent(res, AddressType.COUNTRY);
+    }
+
+    private static AddressComponent getCity(GeocodingResult[] res) {
+        return getComponent(res, AddressType.LOCALITY);
     }
 
+    private static AddressComponent getPostalCode(GeocodingResult[] res) {
+        return getComponent(res, AddressType.POSTAL_CODE);
+    }
+
+    private static AddressComponent getRegion(GeocodingResult[] res) {
+        return getComponent(res, AddressType.ADMINISTRATIVE_AREA_LEVEL_1);
+    }
+
+    @Override
+    protected void doStart() {
+        context = endpoint.createGeoApiContext();
+    }
 }
diff --git 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/HttpClientConfigurer.java
 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeocoderStatus.java
similarity index 63%
rename from 
components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/HttpClientConfigurer.java
rename to 
components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeocoderStatus.java
index 0d0026976a3..d8132ddca1c 100644
--- 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/HttpClientConfigurer.java
+++ 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeocoderStatus.java
@@ -14,22 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.geocoder.http;
 
-import org.apache.commons.httpclient.HttpClient;
+package org.apache.camel.component.geocoder;
 
-/**
- * A pluggable strategy for configuring the HttpClient used by this component
- *
- * @version 
- */
-public interface HttpClientConfigurer {
+public enum GeocoderStatus {
+    ERROR,
+    INVALID_REQUEST,
+    ACCESS_NOT_CONFIGURED,
+    OK,
+    OVER_QUERY_LIMIT,
+    OVER_DAILY_LIMIT,
+    REQUEST_DENIED,
+    UNKNOWN_ERROR,
+    ZERO_RESULTS;
+
+    public String value() {
+        return name();
+    }
 
-    /**
-     * Configure the HttpClient such as setting the authentication or proxying 
details
-     *
-     * @param client the client
-     * @return the client
-     */
-    HttpClient configureHttpClient(HttpClient client);
-}
+    public static GeocoderStatus fromValue(String v) {
+        return valueOf(v);
+    }
+}
\ No newline at end of file
diff --git 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/AuthenticationHttpClientConfigurer.java
 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/AuthenticationHttpClientConfigurer.java
deleted file mode 100644
index 6ee789034a7..00000000000
--- 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/AuthenticationHttpClientConfigurer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.geocoder.http;
-
-import org.apache.commons.httpclient.Credentials;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.NTCredentials;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthScope;
-
-
-public final class AuthenticationHttpClientConfigurer implements 
HttpClientConfigurer {
-
-    private final boolean proxy;
-    private final Credentials credentials;
-
-    private AuthenticationHttpClientConfigurer(boolean proxy, Credentials 
credentials) {
-        this.proxy = proxy;
-        this.credentials = credentials;
-    }
-
-    @Override
-    public HttpClient configureHttpClient(HttpClient client) {
-        if (proxy) {
-            client.getState().setProxyCredentials(AuthScope.ANY, 
this.credentials);
-        } else {
-            client.getState().setCredentials(AuthScope.ANY, this.credentials);
-        }
-
-        return client;
-    }
-
-    public static HttpClientConfigurer basicAutenticationConfigurer(boolean 
proxy, String user, String pwd) {
-        return new AuthenticationHttpClientConfigurer(proxy, new 
UsernamePasswordCredentials(user, pwd));
-    }
-
-    public static HttpClientConfigurer ntlmAutenticationConfigurer(boolean 
proxy, String user, String pwd, String domain, String host) {
-        return new AuthenticationHttpClientConfigurer(proxy, new 
NTCredentials(user, pwd, host, domain));
-    }
-}
diff --git 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/AuthenticationMethod.java
 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/AuthenticationMethod.java
index 0e07b4a0787..a3f294ea185 100644
--- 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/AuthenticationMethod.java
+++ 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/AuthenticationMethod.java
@@ -23,5 +23,5 @@
  */
 public enum AuthenticationMethod {
 
-    Basic, Digest, NTLM
+    Basic, Digest
 }
diff --git 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/CompositeHttpConfigurer.java
 
b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/CompositeHttpConfigurer.java
deleted file mode 100644
index 182c1927336..00000000000
--- 
a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/http/CompositeHttpConfigurer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.geocoder.http;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.httpclient.HttpClient;
-
-public class CompositeHttpConfigurer implements HttpClientConfigurer {
-    
-    private final List<HttpClientConfigurer> configurers = new ArrayList<>();
-    
-    public void addConfigurer(HttpClientConfigurer configurer) {
-        if (configurer != null) {
-            configurers.add(configurer);
-        }
-    }
-    
-    public void removeConfigurer(HttpClientConfigurer configurer) {
-        configurers.remove(configurer);
-    }
-
-    public HttpClient configureHttpClient(HttpClient client) {
-        for (HttpClientConfigurer configurer : configurers) {
-            configurer.configureHttpClient(client);
-        }
-
-        return client;
-    }
-
-    public List<HttpClientConfigurer> getConfigurers() {
-        return Collections.unmodifiableList(configurers);
-    }
-}
diff --git 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderApiKeyTestBase.java
 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderApiKeyTestBase.java
new file mode 100644
index 00000000000..ff7e9f87e83
--- /dev/null
+++ 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderApiKeyTestBase.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.geocoder;
+
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.AssumptionViolatedException;
+import org.junit.Before;
+
+public class GeoCoderApiKeyTestBase extends CamelTestSupport {
+
+    @Before
+    public void before() {
+        String apiKey = getApiKey();
+        if (apiKey == null) {
+            throw new AssumptionViolatedException("API key not found in 
CAMEL_GEOCODER_APIKEY environment variable, skipping this test");
+        }
+    }
+
+    protected String getApiKey() {
+        return System.getenv("CAMEL_GEOCODER_APIKEY");
+    }
+}
diff --git 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderComponentAddressTest.java
 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderComponentAddressTest.java
index 16d8bd6b738..17789612a84 100644
--- 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderComponentAddressTest.java
+++ 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderComponentAddressTest.java
@@ -18,19 +18,19 @@
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class GeoCoderComponentAddressTest extends CamelTestSupport {
+public class GeoCoderComponentAddressTest extends GeoCoderApiKeyTestBase {
 
     @Test
     public void testGeoCoder() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
 
+        mock.expectedHeaderReceived(GeoCoderConstants.LATLNG, 
"55.67609680,12.56833720");
         // the address header overrides the endpoint configuration
-        template.sendBodyAndHeader("direct:start", "Hello", 
GeoCoderConstants.ADDRESS, "Copenhagen, Denmark");
-        
+        template.sendBodyAndHeader("direct:start", "Hello", 
GeoCoderConstants.ADDRESS, " ");
+
         assertMockEndpointsSatisfied();
     }
 
@@ -39,10 +39,10 @@ protected RouteBuilder createRouteBuilder() throws 
Exception {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                    .to("geocoder:address:Paris, France")
-                    .to("log:result")
-                    .log("Location ${header.CamelGeocoderAddress} is at 
lat/lng: ${header.CamelGeocoderLatlng} in city ${header.CamelGeocoderCity}")
-                    .to("mock:result");
+                        .to("geocoder:address: empty?apiKey=" + getApiKey())
+                        .to("log:result")
+                        .log("Location ${header.CamelGeocoderAddress} is at 
lat/lng: ${header.CamelGeocoderLatlng} in city ${header.CamelGeocoderCity}")
+                        .to("mock:result");
             }
         };
     }
diff --git 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderCurrentAddressTest.java
 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderCurrentAddressTest.java
index 23cd1d44e5e..ea666d1b423 100644
--- 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderCurrentAddressTest.java
+++ 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderCurrentAddressTest.java
@@ -18,14 +18,14 @@
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class GeoCoderCurrentAddressTest extends CamelTestSupport {
+public class GeoCoderCurrentAddressTest extends GeoCoderApiKeyTestBase  {
 
     @Test
     public void testGeoCoder() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
         mock.expectedBodiesReceived("Hello");
         mock.message(0).header(GeoCoderConstants.LATLNG).isNotNull();
 
@@ -39,7 +39,7 @@ protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                    .to("geocoder:address:current?headersOnly=true")
+                    .to("geocoder:address:current?headersOnly=true&apiKey=" + 
getApiKey())
                     .to("log:result")
                     .log("You are at ${header.CamelGeoCoderLatlng} in city 
${header.CamelGeoCoderCity} in country ${header.CamelGeoCoderCountryLong}")
                     .to("mock:result");
diff --git 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderEmptyAddressTest.java
 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderEmptyAddressTest.java
new file mode 100644
index 00000000000..93be10adc05
--- /dev/null
+++ 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderEmptyAddressTest.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.geocoder;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+public class GeoCoderEmptyAddressTest extends GeoCoderApiKeyTestBase {
+
+    @Test
+    public void testGeoCoder() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+
+        mock.expectedHeaderReceived(GeoCoderConstants.STATUS, 
GeocoderStatus.ZERO_RESULTS);
+        // the address header overrides the endpoint configuration
+        template.sendBodyAndHeader("direct:start", "Hello", 
GeoCoderConstants.ADDRESS, " ");
+        
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:start")
+                    .to("geocoder:address: ?apiKey=" + getApiKey())
+                    .to("log:result")
+                    .log("Location ${header.CamelGeocoderAddress} is at 
lat/lng: ${header.CamelGeocoderLatlng} in city ${header.CamelGeocoderCity}")
+                    .to("mock:result");
+            }
+        };
+    }
+}
diff --git 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderLatLngComponentTest.java
 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderLatLngComponentTest.java
index 314e2232a9e..0e816fd31de 100644
--- 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderLatLngComponentTest.java
+++ 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderLatLngComponentTest.java
@@ -18,10 +18,9 @@
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class GeoCoderLatLngComponentTest extends CamelTestSupport {
+public class GeoCoderLatLngComponentTest extends GeoCoderApiKeyTestBase {
 
     @Test
     public void testGeoCoder() throws Exception {
@@ -41,7 +40,7 @@ protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:start")
-                    .to("geocoder:latlng:40.714224,-73.961452")
+                    .to("geocoder:latlng:40.714224,-73.961452?apiKey=" + 
getApiKey())
                     .to("log:result")
                     .log("Location ${header.CamelGeocoderAddress} is at 
lat/lng: ${header.CamelGeocoderLatlng}"
                         + " and in city ${header.CamelGeoCoderCity} in country 
${header.CamelGeoCoderCountryLong}")
diff --git 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderProxyTest.java
 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderProxyTest.java
index 05133275d03..58721f754df 100644
--- 
a/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderProxyTest.java
+++ 
b/components/camel-geocoder/src/test/java/org/apache/camel/component/geocoder/GeoCoderProxyTest.java
@@ -16,28 +16,43 @@
  */
 package org.apache.camel.component.geocoder;
 
-import com.google.code.geocoder.Geocoder;
-import com.google.code.geocoder.model.GeocodeResponse;
-import com.google.code.geocoder.model.GeocoderRequest;
-import com.google.code.geocoder.model.LatLng;
+
+import com.google.maps.GeoApiContext;
+import com.google.maps.GeocodingApi;
+import com.google.maps.GeocodingApiRequest;
+import com.google.maps.model.GeocodingResult;
+import com.google.maps.model.LatLng;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore("This test should be executed manually")
-public class GeoCoderProxyTest extends CamelTestSupport {
+@Ignore("This test should be executed manually with a proxy set up")
+public class GeoCoderProxyTest extends GeoCoderApiKeyTestBase {
 
     @Test
-    public void testGeoCoder() throws Exception {
+    public void testGeoCoderProxyNoAuth() throws Exception {
         GeoCoderEndpoint endpoint = context.getEndpoint(
-            
"geocoder:address:current?headersOnly=true&proxyHost=localhost&proxyPort=3128&proxyAuthMethod=Basic&proxyAuthUsername=proxy&proxyAuthPassword=proxy",
+            
"geocoder:address:current?headersOnly=true&proxyHost=localhost&proxyPort=8888&apiKey="+getApiKey(),
             GeoCoderEndpoint.class);
 
-        Geocoder geocoder = endpoint.createGeocoder();
-        GeocoderRequest req = new GeocoderRequest();
-        req.setLocation(new LatLng("45.4643", "9.1895"));
-        GeocodeResponse res = geocoder.geocode(req);
+        GeoApiContext context = endpoint.createGeoApiContext();
+        GeocodingApiRequest geocodingApiRequest = 
GeocodingApi.reverseGeocode(context, new LatLng(45.4643, 9.1895));
+        GeocodingResult[] results = geocodingApiRequest.await();
+
+        log.info("Response {}", results);
+    }
+
+    @Test
+    public void testGeoCoderWithAuth() throws Exception {
+        GeoCoderEndpoint endpoint = context.getEndpoint(
+                
"geocoder:address:current?headersOnly=true&proxyHost=localhost&proxyPort=8888&proxyAuthMethod=Basic&proxyAuthUsername=proxy&proxyAuthPassword=proxy&apiKey="+getApiKey(),
+                GeoCoderEndpoint.class);
 
-        log.info("Response {} ", res);
+        GeoApiContext context = endpoint.createGeoApiContext();
+        GeocodingApiRequest geocodingApiRequest = 
GeocodingApi.reverseGeocode(context, new LatLng(45.4643, 9.1895));
+        GeocodingResult[] results = geocodingApiRequest.await();
+
+        log.info("Response {}", results);
     }
+
 }
diff --git a/parent/pom.xml b/parent/pom.xml
index 4b331e221e1..0a22e6bdd46 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -228,6 +228,7 @@
     <findbugs-maven-plugin-version>2.5.2</findbugs-maven-plugin-version>
     <google-findbugs-jsr305-version>3.0.2</google-findbugs-jsr305-version>
     
<google-findbugs-annotations2-version>2.0.3</google-findbugs-annotations2-version>
+    <google-maps-services-version>0.2.9</google-maps-services-version>
     <flatpack-version>3.4.3</flatpack-version>
     <flink-version>1.5.0</flink-version>
     <fop-bundle-version>2.3_1</fop-bundle-version>
@@ -236,7 +237,6 @@
     <freemarker-version>2.3.28</freemarker-version>
     <generex-bundle-version>1.0.1_2</generex-bundle-version>
     <gentlyweb-bundle-version>1.5_1</gentlyweb-bundle-version>
-    <geocoder-java-version>0.16</geocoder-java-version>
     
<geronimo-annotation-1.0-spec-version>1.1.1</geronimo-annotation-1.0-spec-version>
     
<geronimo-annotation-1.2-spec-version>1.0</geronimo-annotation-1.2-spec-version>
     
<geronimo-atinject-1.0-spec-version>1.0</geronimo-atinject-1.0-spec-version>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> camel-geocoder - Use new API
> ----------------------------
>
>                 Key: CAMEL-12554
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12554
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-geocoder
>            Reporter: Claus Ibsen
>            Priority: Major
>             Fix For: 2.23.0
>
>
> See
> [https://github.com/apilayer/freegeoip#readme]
> There is a newer API. Not sure if we have migrated already, but as the old 
> API is terminated in July 2018 then we dont have so much time.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to