commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject HttpClient use Proxy Server with Basic Auth
Date Fri, 03 Jun 2005 15:36:42 GMT

I'm trying to get URLs via a Proxy Server.  No matter what I try, i get
an SC 407 - Proxy Authorization Required.  Can somebody send me an example
of using HttpClient with a Proxy Server which requires Basic Auth?

This is what I'm doing:
        String _proxyHost = System.getProperty("http.proxyHost");
        if(_proxyHost != null) {
            HostConfiguration _hc = HostConfiguration();
            _hc.setProxy(_proxyHost, Integer.parseInt(System.getProperty("http.proxyPort")));
            Credentials _creds = new UsernamePasswordCredentials(System.getProperty("http.proxyUser"),
            _client.getState().setProxyCredentials(null, _proxyHost, _creds);

        GetMethod get = new GetMethod(aURL);
        int _status = _client.executeMethod(get);
        //this doesn't work either: int _status = _client.executeMethod(_client.getHostConfiguration(),
get, _client.getState());


Vijay Garla

Das Italien-Gewinnspiel
Jetzt bei der Italien-Reise mitspielen und einen von 30 Preisen gewinnen.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message