use of org.apache.http.util.VersionInfo in project robovm by robovm.
the class DefaultHttpClient method createHttpParams.
@Override
protected HttpParams createHttpParams() {
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET);
/*
* Android note: Send each request body without first asking the server
* whether it will be accepted. Asking first slows down the common case
* and results in "417 expectation failed" errors when a HTTP/1.0 server
* is behind a proxy. http://b/2471595
*/
HttpProtocolParams.setUseExpectContinue(params, // android-changed
false);
// determine the release version from packaged version info
final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", getClass().getClassLoader());
final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE;
HttpProtocolParams.setUserAgent(params, "Apache-HttpClient/" + release + " (java 1.4)");
return params;
}
use of org.apache.http.util.VersionInfo in project algoliasearch-client-java by algolia.
the class APIClient method getFallbackDomain.
/**
* Get the appropriate fallback domain depending on the current SNI support.
* Checks Java version and Apache HTTP Client's version.
*
* @return algolianet.com if the current setup supports SNI, else algolia.net.
*/
static String getFallbackDomain() {
int javaVersion = getJavaVersion();
boolean javaHasSNI = javaVersion >= 7;
final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", APIClient.class.getClassLoader());
String version = vi.getRelease();
String[] split = version.split("\\.");
int major = Integer.parseInt(split[0]);
int minor = Integer.parseInt(split[1]);
int patch = Integer.parseInt(split[2]);
boolean apacheClientHasSNI = major > 4 || major == 4 && minor > 3 || // if version >= 4.3.2
major == 4 && minor == 3 && patch >= 2;
if (apacheClientHasSNI && javaHasSNI) {
return "algolianet.com";
} else {
return "algolia.net";
}
}
use of org.apache.http.util.VersionInfo in project XobotOS by xamarin.
the class DefaultHttpClient method createHttpParams.
@Override
protected HttpParams createHttpParams() {
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET);
/*
* Android note: Send each request body without first asking the server
* whether it will be accepted. Asking first slows down the common case
* and results in "417 expectation failed" errors when a HTTP/1.0 server
* is behind a proxy. http://b/2471595
*/
HttpProtocolParams.setUseExpectContinue(params, // android-changed
false);
// determine the release version from packaged version info
final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", getClass().getClassLoader());
final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE;
HttpProtocolParams.setUserAgent(params, "Apache-HttpClient/" + release + " (java 1.4)");
return params;
}
use of org.apache.http.util.VersionInfo in project platform_external_apache-http by android.
the class DefaultHttpClient method createHttpParams.
@Override
protected HttpParams createHttpParams() {
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET);
/*
* Android note: Send each request body without first asking the server
* whether it will be accepted. Asking first slows down the common case
* and results in "417 expectation failed" errors when a HTTP/1.0 server
* is behind a proxy. http://b/2471595
*/
HttpProtocolParams.setUseExpectContinue(params, // android-changed
false);
// determine the release version from packaged version info
final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", getClass().getClassLoader());
final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE;
HttpProtocolParams.setUserAgent(params, "Apache-HttpClient/" + release + " (java 1.4)");
return params;
}
Aggregations