commons-user mailing list archives

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

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")));
            _client.setHostConfiguration(_hc);
            Credentials _creds = new UsernamePasswordCredentials(System.getProperty("http.proxyUser"),
System.getProperty("http.proxyPassword")); 
            _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());


TIA,

Vijay Garla

__________________________________________________________________
Das Italien-Gewinnspiel
Jetzt bei der Italien-Reise mitspielen und einen von 30 Preisen gewinnen.
http://spielmanege.tiscali.de/italienreise/italien.php




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message