Example usage for org.apache.http.util VersionInfo getRelease

List of usage examples for org.apache.http.util VersionInfo getRelease

Introduction

In this page you can find the example usage for org.apache.http.util VersionInfo getRelease.

Prototype

public final String getRelease() 

Source Link

Usage

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  om
 * 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: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.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.gooddata.GoodData.java

private String getUserAgent() {
    final Package pkg = Package.getPackage("com.gooddata");
    final String clientVersion = pkg != null && pkg.getImplementationVersion() != null
            ? pkg.getImplementationVersion()
            : UNKNOWN_VERSION;/*from w  ww .  ja v  a2  s . co  m*/

    final VersionInfo vi = loadVersionInfo("org.apache.http.client", HttpClientBuilder.class.getClassLoader());
    final String apacheVersion = vi != null ? vi.getRelease() : UNKNOWN_VERSION;

    return String.format("%s/%s (%s; %s) %s/%s", "GoodData-Java-SDK", clientVersion,
            System.getProperty("os.name"), System.getProperty("java.specification.version"),
            "Apache-HttpClient", apacheVersion);
}

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.c o m
    } else {
        return String.format("%s/%d.%d localhost (Apache-HttpClient/%s (cache))", pv.getProtocol(),
                pv.getMajor(), pv.getMinor(), release);
    }
}

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 ww.  j  a va2  s  .com*/

    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;
    }/* w w  w .ja  va 2 s  .c om*/

    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;
}