Mit HttpProxy Verbindung zu einem host mit preemtive-Authentifizierung

Bin ich mit HttpClient eine Verbindung zu einem host erfordert BasicAUTH. Aber der proxy nicht die eine Authentifizierung erfordern. Ich habe es eingerichtet, wie folgt:

private final HttpClient httpClient; //Spring injected

Einstellung Basic-auth:

private void setBasicAuth(final String username, final String password) {
    httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM), new UsernamePasswordCredentials(username, password));
    httpClient.getParams().setAuthenticationPreemptive(true);
}

Einstellung proxy:

private void setProxy(final String proxyHost, final int proxyPort) {
    hostConfiguration hostConfiguration = httpClient.getHostConfiguration();
    hostConfiguration.setProxy(proxyHost, proxyPort);
}

Aber ich bekomme folgende Warnungen, wenn der code ausgeführt wird. Alles funktioniert, aber ich möchte, um loszuwerden, die Warnungen, wie gut (oder zumindest zu verstehen, warum Sie angezeigt wird)

WARN  o.a.c.httpclient.HttpMethodDirector - Required proxy credentials not available for BASIC <any realm>@proxy.XXXXXX.no:3128
WARN  o.a.c.httpclient.HttpMethodDirector - Preemptive authentication requested but no default proxy credentials available

Irgendwelche Ideen?

InformationsquelleAutor Espen Herseth Halvorsen | 2011-04-15

Schreibe einen Kommentar