List of usage examples for org.apache.http.util VersionInfo loadVersionInfo
public static VersionInfo loadVersionInfo(String str, ClassLoader classLoader)
From source file:io.aos.protocol.http.httpcommon.PrintVersionInfo.java
/** * Prints version information.//from w w w . ja v a 2 s. c o m * * @param args command line arguments. Leave empty to print version * information for the default packages. Otherwise, pass * a list of packages for which to get version info. */ public static void main(String... args) { String[] pckgs = (args.length > 0) ? args : MODULE_LIST; VersionInfo[] via = VersionInfo.loadVersionInfo(pckgs, null); System.out.println("version info for thread context classloader:"); for (int i = 0; i < via.length; i++) System.out.println(via[i]); System.out.println(); // if the version information for the classloader of this class // is different from that for the thread context classloader, // there may be a problem with multiple versions inputStreamthe classpath via = VersionInfo.loadVersionInfo(pckgs, PrintVersionInfo.class.getClassLoader()); System.out.println("version info for static classloader:"); for (int i = 0; i < via.length; i++) System.out.println(via[i]); }
From source file:org.vietspider.net.client.impl.AnonymousHttpClient.java
@Override protected HttpParams createHttpParams() { HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET); HttpProtocolParams.setUseExpectContinue(params, true); // 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; }
From source file:com.jrodeo.queue.messageset.provider.TestHttpClient4.java
public String getClientName() { VersionInfo vinfo = VersionInfo.loadVersionInfo("org.apache.http.client", Thread.currentThread().getContextClassLoader()); return "Apache HttpClient 4 (ver: " + ((vinfo != null) ? vinfo.getRelease() : VersionInfo.UNAVAILABLE) + ")"; }
From source file:com.jrodeo.remote.TestHttpCore.java
public String getClientName() { VersionInfo vinfo = VersionInfo.loadVersionInfo("org.apache.http", Thread.currentThread().getContextClassLoader()); return "Apache HttpCore 4 (ver: " + ((vinfo != null) ? vinfo.getRelease() : VersionInfo.UNAVAILABLE) + ")"; }
From source file:org.iipg.hurricane.jmx.client.JMXClientBuilder.java
private String getVersionInfo() { // determine the release version from packaged version info final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", getClass().getClassLoader()); return (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE; }
From source file:com.apigee.sdk.apm.http.impl.client.cache.CachingHttpClient.java
private String generateViaHeader(HttpMessage msg) { final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", getClass().getClassLoader()); final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE; final ProtocolVersion pv = msg.getProtocolVersion(); if ("http".equalsIgnoreCase(pv.getProtocol())) { return String.format("%d.%d localhost (Apache-HttpClient/%s (cache))", pv.getMajor(), pv.getMinor(), release);/*from w ww . j a v a2 s . co m*/ } else { return String.format("%s/%d.%d localhost (Apache-HttpClient/%s (cache))", pv.getProtocol(), pv.getMajor(), pv.getMinor(), release); } }
From source file:org.jets3t.service.utils.RestUtils.java
/** * Default Http parameters got from the DefaultHttpClient implementation. * * @return/* w w w . j ava2 s . c o m*/ * Default HTTP connection parameters */ public static HttpParams createDefaultHttpParams() { HttpParams params = new SyncBasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET); HttpConnectionParams.setTcpNoDelay(params, true); HttpConnectionParams.setSocketBufferSize(params, 8192); // determine the release version from packaged version info final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", HttpClient.class.getClassLoader()); final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE; HttpProtocolParams.setUserAgent(params, "Apache-HttpClient/" + release + " (java 1.5)"); return params; }
From source file:org.apache.http.impl.client.cache.CachingExec.java
private String generateViaHeader(final HttpMessage msg) { final ProtocolVersion pv = msg.getProtocolVersion(); final String existingEntry = viaHeaders.get(pv); if (existingEntry != null) { return existingEntry; }/* w w w . j a v a 2 s . c o m*/ final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", getClass().getClassLoader()); final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE; String value; if ("http".equalsIgnoreCase(pv.getProtocol())) { value = String.format("%d.%d localhost (Apache-HttpClient/%s (cache))", pv.getMajor(), pv.getMinor(), release); } else { value = String.format("%s/%d.%d localhost (Apache-HttpClient/%s (cache))", pv.getProtocol(), pv.getMajor(), pv.getMinor(), release); } viaHeaders.put(pv, value); return value; }
From source file:org.apache.http.impl.client.cache.CachingHttpAsyncClient.java
private String generateViaHeader(final HttpMessage msg) { final ProtocolVersion pv = msg.getProtocolVersion(); final String existingEntry = viaHeaders.get(pv); if (existingEntry != null) { return existingEntry; }// www. j a va2 s .co m final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", getClass().getClassLoader()); final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE; final String value; if ("http".equalsIgnoreCase(pv.getProtocol())) { value = String.format("%d.%d localhost (Apache-HttpClient/%s (cache))", pv.getMajor(), pv.getMinor(), release); } else { value = String.format("%s/%d.%d localhost (Apache-HttpClient/%s (cache))", pv.getProtocol(), pv.getMajor(), pv.getMinor(), release); } viaHeaders.put(pv, value); return value; }