Example usage for org.apache.http.impl.client.cache CachingHttpAsyncClient CachingHttpAsyncClient

List of usage examples for org.apache.http.impl.client.cache CachingHttpAsyncClient CachingHttpAsyncClient

Introduction

In this page you can find the example usage for org.apache.http.impl.client.cache CachingHttpAsyncClient CachingHttpAsyncClient.

Prototype

public CachingHttpAsyncClient(final HttpAsyncClient client, final ResourceFactory resourceFactory,
            final HttpCacheStorage storage, final CacheConfig config) 

Source Link

Usage

From source file:org.callimachusproject.server.chain.CacheHandler.java

private synchronized HttpAsyncClient getClient(HttpHost target) {
    if (clients.containsKey(target))
        return clients.get(target);
    logger.debug("Initializing server side cache for {}", target);
    ManagedHttpCacheStorage storage = new ManagedHttpCacheStorage(config);
    CachingHttpAsyncClient cachingClient = new CachingHttpAsyncClient(new DelegatingClient(delegate),
            resourceFactory, storage, config);
    HttpAsyncClient client = new AutoClosingAsyncClient(cachingClient, storage);
    clients.put(target, client);/*w w w  .j  a  v a  2  s .c  om*/
    return client;
}