J3daiah / geocoder-java

Automatically exported from code.google.com/p/geocoder-java
0 stars 0 forks source link

Add support for HttpProxy #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. using the library behind a proxy you'll get an java.net.ConnectException: 
Connection timed out: connect
2.
3.

What is the expected output? What do you see instead?
I expect the library to work behind a proxy

What version of the product are you using? On what operating system?
0.15 (happens on all platforms)

Please provide any additional information below.
com.google.code.geocoder.Geocoder.request(Gson gson, String urlString) doesn't 
include a proxy when opening the stream on the URL. 

It should include a java.net.Proxy.NO_PROXY unless some properties are given in 
order to set up the proxy (maybe another Geocoder constructor receiving a Proxy 
instance).

You can use System-wide properties to mitigate the issue, (-Dhttp.proxyHost 
etc.), but sometimes those cannot be changed

cfr. with http://stackoverflow.com/a/1433296

Original issue reported on code.google.com by juanpabl...@gmail.com on 4 Oct 2013 at 10:43

GoogleCodeExporter commented 9 years ago
closeable, proxy can be established via

final AdvancedGeoCoder advancedGeoCoder = new AdvancedGeoCoder();
advancedGeoCoder.getHttpClient().getHostConfiguration().setProxy("proxy.example.
com", 8080);
GeocoderRequest geocoderRequest = new 
GeocoderRequestBuilder().setAddress("Paris, 
France").setLanguage("en").getGeocoderRequest();
GeocodeResponse geocoderResponse = geocoder.geocode(geocoderRequest);

nothing like reading documentation, duh..

duh..

Original comment by juanpabl...@gmail.com on 7 Oct 2013 at 7:18

GoogleCodeExporter commented 9 years ago
Seems like there's an error:

GeocodeResponse geocoderResponse = geocoder.geocode(geocoderRequest);

You're calling geocoder, but I guess you should call advancedGeoCoder instead. 
Or am I missing something?

Original comment by cockabon...@gmail.com on 13 Mar 2014 at 2:06

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Update example

Original comment by panchmp on 30 Apr 2014 at 10:42