Package org.apache.http.client.cache

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


    public void testIssue1147() throws Exception {
        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();
View Full Code Here


    }

    @Override
    protected ClientExecChain decorateMainExec(final ClientExecChain mainExec) {
        final CacheConfig config = this.cacheConfig != null ? this.cacheConfig : CacheConfig.DEFAULT;
        ResourceFactory resourceFactory = this.resourceFactory;
        if (resourceFactory == null) {
            if (this.cacheDir == null) {
                resourceFactory = new HeapResourceFactory();
            } else {
                resourceFactory = new FileResourceFactory(cacheDir);
View Full Code Here

        final CacheConfig cacheConfig = CacheConfig.custom()
            .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();
View Full Code Here

        final CacheConfig cacheConfig = CacheConfig.custom()
            .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();
View Full Code Here

    public void testIssue1147() throws Exception {
        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();
View Full Code Here

    }

    @Override
    protected ClientExecChain decorateMainExec(final ClientExecChain mainExec) {
        final CacheConfig config = this.cacheConfig != null ? this.cacheConfig : CacheConfig.DEFAULT;
        ResourceFactory resourceFactory = this.resourceFactory;
        if (resourceFactory == null) {
            if (this.cacheDir == null) {
                resourceFactory = new HeapResourceFactory();
            } else {
                resourceFactory = new FileResourceFactory(cacheDir);
View Full Code Here

        final CacheConfig cacheConfig = CacheConfig.custom()
            .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();
View Full Code Here

    }

    @Override
    protected ClientExecChain decorateMainExec(final ClientExecChain mainExec) {
        final CacheConfig config = this.cacheConfig != null ? this.cacheConfig : CacheConfig.DEFAULT;
        ResourceFactory resourceFactory = this.resourceFactory;
        if (resourceFactory == null) {
            if (this.cacheDir == null) {
                resourceFactory = new HeapResourceFactory();
            } else {
                resourceFactory = new FileResourceFactory(cacheDir);
View Full Code Here

        final CacheConfig cacheConfig = CacheConfig.custom()
            .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();
View Full Code Here

    @Override
    protected ClientExecChain decorateMainExec(final ClientExecChain mainExec) {
        final CacheConfig config = this.cacheConfig != null ? this.cacheConfig : CacheConfig.DEFAULT;
        // We copy the instance fields to avoid changing them, and rename to avoid accidental use of the wrong version
        ResourceFactory resourceFactoryCopy = this.resourceFactory;
        if (resourceFactoryCopy == null) {
            if (this.cacheDir == null) {
                resourceFactoryCopy = new HeapResourceFactory();
            } else {
                resourceFactoryCopy = new FileResourceFactory(cacheDir);
View Full Code Here

TOP

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

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.