hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: AW: WG: Re: postmethod proxy authentication failing
Date Mon, 09 Jan 2006 16:37:00 GMT
Hi Simon,

Simon Buettner wrote:
> Hi Roland, i tried this code:
> 	FilePost.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(file), file.length()));
>         	try {
> 		//Proxy konfigurieren
> 		if(proxyInfo.isUsingProxyServer())
>         	{
> 		//Proxy Infos
> 		mHttpClient.getHostConfiguration().setProxyHost(new ProxyHost(proxyInfo.getProxyHost(),proxyInfo.getProxyPort()));
>         		mHttpClient.getState().setProxyCredentials(new AuthScope(proxyInfo.getProxyHost(),
proxyInfo.getProxyPort()), proxyInfo.getProxyCredentials());  
>         		
>         	}
> 		filePost.setDoAuthentication(true);
> 		mHttpClient.getParams().setAuthenticationPreemptive(true);
> 		mHttpClient.getState().setCredentials(new AuthScope(proxyInfo.getProxyHost(), proxyInfo.getProxyPort()),
 proxyInfo.getProxyCredentials());
> 		
> 		int status = mHttpClient.executeMethod(filePost);
> 	}
> 	catch(Exception e){
> 		e.printStackTrace();
> 	}
> 
> 
> And i get the following exception:
> 09.01.2006 16:34:12 org.apache.commons.httpclient.HttpMethodDirector authenticateHost
> WARNUNG: Required credentials not available for BASIC <any realm>@localhost:80
> 09.01.2006 16:34:12 org.apache.commons.httpclient.HttpMethodDirector authenticateHost
> WARNUNG: Preemptive authentication requested but no default credentials available

That is not an exception, it is a warning. Either the proxy credentials or
the credentials for the target server are not set as default credentials. If
you don't have to authenticate against both at the same time, that should be
ok. HttpClient can't tell whether it is supposed to perform preemptive auth
only against the proxy, or only against the target server, or both. So it
prints a warning about the missing credentials, just in case.


cheers,
  Roland



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


Mime
View raw message