Thank you for your answer Oleg. I will add an authentication type selection to my client application.
Simon -----Ursprüngliche Nachricht----- Von: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 11. Januar 2006 18:39 An: HttpClient User Discussion Betreff: Re: AW: AW: WG: Re: postmethod proxy authentication failing On Tue, 2006-01-10 at 10:55 +0100, Simon Buettner wrote: > Hi Roland, > Thank you for your help. At least it works with preemptive > authentication. > > Do you know how i can set a automatic retry with different proxy > authentication schemes? For example first try basic, then digest and > then the microsoft thing. > Simon, HttpClient does not support re-authentication using a different (weaker) authentication scheme if the primary one (the most secure of all supported) fails. This behaviour is in line with requirements of the HTTP spec. However, one can force HttpClient to use an alternate auth scheme priority thus making it pick up a weaker scheme over stronger one. Based on that you can implement a custom authentication retry mechanism you desire. For details see the HttpClient authentication guide: http://jakarta.apache.org/commons/httpclient/authentication.html#Alternate%20authentication Hope this helps Oleg > Greetings > > Simon > > -----Ursprüngliche Nachricht----- > Von: Roland Weber [mailto:[EMAIL PROTECTED] > Gesendet: Montag, 9. Januar 2006 17:37 > An: HttpClient User Discussion > Betreff: Re: AW: WG: Re: postmethod proxy authentication failing > > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
