use of org.eclipse.ecf.internal.provider.filetransfer.httpclient4.ISSLSocketFactoryModifier in project ecf by eclipse.
the class HttpClientRetrieveFileTransfer method registerSchemes.
private synchronized void registerSchemes(ISocketEventSource source, ISocketListener socketListener) {
SchemeRegistry schemeRegistry = this.httpClient.getConnectionManager().getSchemeRegistry();
Scheme http = new Scheme(HttpClientRetrieveFileTransfer.HTTP, HTTP_PORT, new ECFHttpClientProtocolSocketFactory(SocketFactory.getDefault(), source, socketListener));
// $NON-NLS-1$
Trace.trace(Activator.PLUGIN_ID, "registering http scheme");
schemeRegistry.register(http);
ISSLSocketFactoryModifier sslSocketFactoryModifier = Activator.getDefault().getSSLSocketFactoryModifier();
if (sslSocketFactoryModifier == null) {
sslSocketFactoryModifier = new HttpClientDefaultSSLSocketFactoryModifier();
}
SSLSocketFactory sslSocketFactory = null;
try {
sslSocketFactory = sslSocketFactoryModifier.getSSLSocketFactory();
} catch (IOException e) {
// $NON-NLS-1$
Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, ISSLSocketFactoryModifier.class, "getSSLSocketFactory()", e);
// $NON-NLS-1$
Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, HttpClientRetrieveFileTransfer.class, "registerSchemes()", e);
// $NON-NLS-1$
throw new ECFRuntimeException("Unable to instantiate schemes for HttpClient.", e);
}
Scheme https = new Scheme(HttpClientRetrieveFileTransfer.HTTPS, HTTPS_PORT, new ECFHttpClientSecureProtocolSocketFactory(sslSocketFactory, source, socketListener));
// $NON-NLS-1$
Trace.trace(Activator.PLUGIN_ID, "registering https scheme; modifier=" + sslSocketFactoryModifier);
schemeRegistry.register(https);
// SPNEGO is not supported, so remove it from the list
List authpref = new ArrayList(3);
authpref.add(AuthPolicy.NTLM);
authpref.add(AuthPolicy.DIGEST);
authpref.add(AuthPolicy.BASIC);
httpClient.getParams().setParameter(AuthPNames.PROXY_AUTH_PREF, authpref);
httpClient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authpref);
}
Aggregations