Patch For java Google APIs to handle proxy settings

5 views
Skip to first unread message

Patrick Chanezon

unread,
Apr 15, 2002, 11:11:21 AM4/15/02
to
Thanks for the Google API: this is the most exciting announcement in
the web service area this year.

My company operates behind a firewall and requires us to go through a
proxy in order to access the web. The current java API does not let
you specify that.
I could use the WSDL and my favorite web service toolkit, but why
bother when Google already did the work for me ?

I created a small Patch for the java Google APIs in order to let it
handle proxy settings.
I decided to share it until Google fixes this in their java API, in
case other developers would find this useful.

You can get it from http://www.chanezon.com/pat/google_proxy_patch.html

P@

Gerry Lau

unread,
Apr 21, 2002, 8:22:49 PM4/21/02
to
Hi Patrick,

Thanks for your hack! I surf the net through the Google (as always ;-) to
find out how to get through the firewall and your hack is the one!! While
it doesn't take lots of effort to add fix to the C# code, I really don't
want to admit the fact that making Java work for something takes much
longer time and effort. Your hack curtails my pain! Google should modify
the API as your suggestion. Thanks again!

Cheers

Gerry


pat...@chanezon.com (Patrick Chanezon) wrote in message news:<eabb2d58.02041...@posting.google.com>...

Boris Magocsi

unread,
Apr 25, 2002, 3:39:45 AM4/25/02
to
pat...@chanezon.com (Patrick Chanezon) wrote in message news:<eabb2d58.02041...@posting.google.com>...

... <snipped> ...

> I created a small Patch for the java Google APIs in order to let it
> handle proxy settings.
> I decided to share it until Google fixes this in their java API, in
> case other developers would find this useful.
>
> You can get it from http://www.chanezon.com/pat/google_proxy_patch.html
>
> P@

Hi,

I am using a (from WDSL) generated interface of the Google Search api
together with Apache Axis (so no googleapi.jar in classpath). Axis
allows you to set the http proxy via the system properties
http.proxyHost and http.proxyPort. I haven't used Axis much, so I
can't attest to stability, etc., but the proxy bit works for me.

Boris

Patrick Chanezon

unread,
Apr 30, 2002, 11:33:50 AM4/30/02
to
Hi Boris, when you use the WSDL, you have no problem:
- if you use Apache SOAP, you can use the setProxyHost and
setProxyPort methods of the object SOAPHTTPConnection
- if you use Axis it seems like setting the environment variable
works. it must be because Axis' implementation uses a URLConnection
and not a socket as does Apache SOAP.

the patch I created is for people who want to use the java API
directly without managing the web service code themselves.

The explanation of why setting environment variables does not work
with the java API can be found at
http://www.chanezon.com/pat/google_proxy_patch.html#proxyhost.

P@

boris....@spmtechnologies.com (Boris Magocsi) wrote in message news:<7027cc6b.0204...@posting.google.com>...

Anup

unread,
May 6, 2002, 11:42:04 AM5/6/02
to
Pat,
Just tried downloading your example and ran into a problem - the
example still finds the GoogleAPIDemo.class located in googleapi.jar.
I think users will also need your updated GoogleAPIDemo.class packaged
in the patgoogle.jar file. Otherwise the example will find the class
file located in googleapi.jar. If not, am I missing something?
Thanks
-anup


boris....@spmtechnologies.com (Boris Magocsi) wrote in message news:<7027cc6b.0204...@posting.google.com>...

Patrick Chanezon

unread,
May 15, 2002, 6:15:45 AM5/15/02
to
You can download the modified version of GoogleAPIDemo.java at
http://www.chanezon.com/pat/GoogleAPIDemo.java and then build it.
Put your build directory before the 2 jars in the classpath, or rename
the demo class to something else, MyGoogleAPIDemo for example.

I did not include it in the patch jar intentionnally, because the
patch adds a feature to the library, and GoogleAPIDemo is just demo
code that has no place in a library jar.

I hope this helps.

P@

mam...@gsb.uchicago.edu (Anup) wrote in message news:<83d283d4.0205...@posting.google.com>...

Patrick Chanezon

unread,
May 31, 2002, 7:50:55 AM5/31/02
to
I just published a new version of the patch at
http://www.chanezon.com/pat/google_proxy_patch.html that includes this
file and will solve your problem.

I hope this helps.

P@

Reply all
Reply to author
Forward
0 new messages