use of org.apache.jena.http.RegistryHttpClient in project jena by apache.
the class Service method chooseHttpClient.
private static HttpClient chooseHttpClient(String serviceURL, Context context) {
// [QExec] Done in HttpLib?
// -- RegistryHttpClient : preferred way to set a custom HttpClient
HttpClient httpClient = RegistryHttpClient.get().find(serviceURL);
if (httpClient == null && context != null) {
// Check for old setting.
if (context.isDefined(oldQueryClient))
LOGGER.warn("Deprecated context symbol " + oldQueryClient + ". See " + httpQueryClient + ".");
Object client = context.get(httpQueryClient);
if (client != null) {
// Check for old HttpClient
if (client.getClass().getName().equals("org.apache.http.client.HttpClient")) {
LOGGER.warn("Found Apache HttpClient for context symbol " + httpQueryClient + ". Jena now uses java.net.http.HttpClient");
client = null;
} else if (client instanceof HttpClient) {
httpClient = (HttpClient) client;
} else {
LOGGER.warn("Not recognized " + httpQueryClient + " -> " + client);
}
}
}
// -- Default : common case.
if (httpClient == null)
httpClient = HttpEnv.getDftHttpClient();
return httpClient;
}
Aggregations