use of org.apache.http.conn.ClientConnectionManagerFactory in project platform_external_apache-http by android.
the class DefaultHttpClient method createClientConnectionManager.
@Override
protected ClientConnectionManager createClientConnectionManager() {
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
registry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
ClientConnectionManager connManager = null;
HttpParams params = getParams();
ClientConnectionManagerFactory factory = null;
// Try first getting the factory directly as an object.
factory = (ClientConnectionManagerFactory) params.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY);
if (factory == null) {
// then try getting its class name.
String className = (String) params.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME);
if (className != null) {
try {
Class<?> clazz = Class.forName(className);
factory = (ClientConnectionManagerFactory) clazz.newInstance();
} catch (ClassNotFoundException ex) {
throw new IllegalStateException("Invalid class name: " + className);
} catch (IllegalAccessException ex) {
throw new IllegalAccessError(ex.getMessage());
} catch (InstantiationException ex) {
throw new InstantiationError(ex.getMessage());
}
}
}
if (factory != null) {
connManager = factory.newInstance(params, registry);
} else {
connManager = new SingleClientConnManager(getParams(), registry);
}
return connManager;
}
use of org.apache.http.conn.ClientConnectionManagerFactory in project XobotOS by xamarin.
the class DefaultHttpClient method createClientConnectionManager.
@Override
protected ClientConnectionManager createClientConnectionManager() {
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
registry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
ClientConnectionManager connManager = null;
HttpParams params = getParams();
ClientConnectionManagerFactory factory = null;
// Try first getting the factory directly as an object.
factory = (ClientConnectionManagerFactory) params.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY);
if (factory == null) {
// then try getting its class name.
String className = (String) params.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME);
if (className != null) {
try {
Class<?> clazz = Class.forName(className);
factory = (ClientConnectionManagerFactory) clazz.newInstance();
} catch (ClassNotFoundException ex) {
throw new IllegalStateException("Invalid class name: " + className);
} catch (IllegalAccessException ex) {
throw new IllegalAccessError(ex.getMessage());
} catch (InstantiationException ex) {
throw new InstantiationError(ex.getMessage());
}
}
}
if (factory != null) {
connManager = factory.newInstance(params, registry);
} else {
connManager = new SingleClientConnManager(getParams(), registry);
}
return connManager;
}
use of org.apache.http.conn.ClientConnectionManagerFactory in project robovm by robovm.
the class DefaultHttpClient method createClientConnectionManager.
@Override
protected ClientConnectionManager createClientConnectionManager() {
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
registry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
ClientConnectionManager connManager = null;
HttpParams params = getParams();
ClientConnectionManagerFactory factory = null;
// Try first getting the factory directly as an object.
factory = (ClientConnectionManagerFactory) params.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY);
if (factory == null) {
// then try getting its class name.
String className = (String) params.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME);
if (className != null) {
try {
Class<?> clazz = Class.forName(className);
factory = (ClientConnectionManagerFactory) clazz.newInstance();
} catch (ClassNotFoundException ex) {
throw new IllegalStateException("Invalid class name: " + className);
} catch (IllegalAccessException ex) {
throw new IllegalAccessError(ex.getMessage());
} catch (InstantiationException ex) {
throw new InstantiationError(ex.getMessage());
}
}
}
if (factory != null) {
connManager = factory.newInstance(params, registry);
} else {
connManager = new SingleClientConnManager(getParams(), registry);
}
return connManager;
}
Aggregations