Package org.apache.http.client.cache

Examples of org.apache.http.client.cache.HttpCacheStorage


        CacheConfig cacheConfig = new CacheConfig();
        cacheConfig.setSharedCache(true);
        cacheConfig.setMaxObjectSizeBytes(262144); //256kb

        ResourceFactory resourceFactory = new FileResourceFactory(cacheDir);
        HttpCacheStorage httpCacheStorage = new ManagedHttpCacheStorage(cacheConfig);

        HttpClient client = EasyMock.createMock(HttpClient.class);
        HttpGet get = new HttpGet("http://somehost/");
        HttpContext context = new BasicHttpContext();
        HttpHost target = new HttpHost("somehost");
View Full Code Here


                resourceFactory = new HeapResourceFactory();
            } else {
                resourceFactory = new FileResourceFactory(cacheDir);
            }
        }
        HttpCacheStorage storage = this.storage;
        if (storage == null) {
            if (this.cacheDir == null) {
                storage = new BasicHttpCacheStorage(cacheConfig);
            } else {
                final ManagedHttpCacheStorage managedStorage = new ManagedHttpCacheStorage(cacheConfig);
View Full Code Here

            .setSharedCache(true)
            .setMaxObjectSize(262144) //256kb
            .build();

        final ResourceFactory resourceFactory = new FileResourceFactory(cacheDir);
        final HttpCacheStorage httpCacheStorage = new ManagedHttpCacheStorage(cacheConfig);

        final ClientExecChain backend = EasyMock.createNiceMock(ClientExecChain.class);
        final HttpRequestWrapper get = HttpRequestWrapper.wrap(new HttpGet("http://somehost/"));
        final HttpClientContext context = HttpClientContext.create();
        final HttpHost target = new HttpHost("somehost");
View Full Code Here

        if (CACHE_MANAGER.cacheExists(TEST_EHCACHE_NAME)){
            CACHE_MANAGER.removeCache(TEST_EHCACHE_NAME);
        }
        CACHE_MANAGER.addCache(TEST_EHCACHE_NAME);
        HttpCacheStorage storage = new EhcacheHttpCacheStorage(CACHE_MANAGER.getCache(TEST_EHCACHE_NAME));
        mockBackend = EasyMock.createMock(HttpClient.class);

        impl = new CachingHttpClient(mockBackend, new HeapResourceFactory(), storage, params);
    }
View Full Code Here

            .setSharedCache(true)
            .setMaxObjectSize(262144) //256kb
            .build();

        final ResourceFactory resourceFactory = new FileResourceFactory(cacheDir);
        final HttpCacheStorage httpCacheStorage = new ManagedHttpCacheStorage(cacheConfig);

        final ClientExecChain backend = EasyMock.createNiceMock(ClientExecChain.class);
        final HttpRequestWrapper get = HttpRequestWrapper.wrap(new HttpGet("http://somehost/"));
        final HttpClientContext context = HttpClientContext.create();
        final HttpHost target = new HttpHost("somehost");
View Full Code Here

        if (CACHE_MANAGER.cacheExists(TEST_EHCACHE_NAME)){
            CACHE_MANAGER.removeCache(TEST_EHCACHE_NAME);
        }
        CACHE_MANAGER.addCache(TEST_EHCACHE_NAME);
        HttpCacheStorage storage = new EhcacheHttpCacheStorage(CACHE_MANAGER.getCache(TEST_EHCACHE_NAME));
        mockBackend = EasyMock.createNiceMock(HttpClient.class);

        impl = new CachingHttpClient(mockBackend, new HeapResourceFactory(), storage, params);
    }
View Full Code Here

        CacheConfig cacheConfig = new CacheConfig();
        cacheConfig.setSharedCache(true);
        cacheConfig.setMaxObjectSize(262144); //256kb

        ResourceFactory resourceFactory = new FileResourceFactory(cacheDir);
        HttpCacheStorage httpCacheStorage = new ManagedHttpCacheStorage(cacheConfig);

        HttpClient client = EasyMock.createNiceMock(HttpClient.class);
        HttpGet get = new HttpGet("http://somehost/");
        HttpContext context = new BasicHttpContext();
        HttpHost target = new HttpHost("somehost");
View Full Code Here

        if (CACHE_MANAGER.cacheExists(TEST_EHCACHE_NAME)){
            CACHE_MANAGER.removeCache(TEST_EHCACHE_NAME);
        }
        CACHE_MANAGER.addCache(TEST_EHCACHE_NAME);
        HttpCacheStorage storage = new EhcacheHttpCacheStorage(CACHE_MANAGER.getCache(TEST_EHCACHE_NAME));
        mockBackend = EasyMock.createMock(HttpClient.class);

        impl = new CachingHttpClient(mockBackend, new HeapResourceFactory(), storage, params);
    }
View Full Code Here

                resourceFactory = new HeapResourceFactory();
            } else {
                resourceFactory = new FileResourceFactory(cacheDir);
            }
        }
        HttpCacheStorage storage = this.storage;
        if (storage == null) {
            if (this.cacheDir == null) {
                storage = new BasicHttpCacheStorage(cacheConfig);
            } else {
                final ManagedHttpCacheStorage managedStorage = new ManagedHttpCacheStorage(cacheConfig);
View Full Code Here

            .setSharedCache(true)
            .setMaxObjectSize(262144) //256kb
            .build();

        final ResourceFactory resourceFactory = new FileResourceFactory(cacheDir);
        final HttpCacheStorage httpCacheStorage = new ManagedHttpCacheStorage(cacheConfig);

        final ClientExecChain backend = EasyMock.createNiceMock(ClientExecChain.class);
        final HttpRequestWrapper get = HttpRequestWrapper.wrap(new HttpGet("http://somehost/"));
        final HttpClientContext context = HttpClientContext.create();
        final HttpHost target = new HttpHost("somehost");
View Full Code Here

TOP

Related Classes of org.apache.http.client.cache.HttpCacheStorage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.