Package org.apache.http.client.cache

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


            final HttpCacheEntry entry) throws IOException {
        final String parentURI = uriExtractor.getURI(target, req);
        final String variantURI = uriExtractor.getVariantURI(target, req, entry);
        storage.putEntry(variantURI, entry);

        final HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {

            public HttpCacheEntry update(final HttpCacheEntry existing) throws IOException {
                return doGetUpdatedParentEntry(
                        req.getRequestLine().getUri(), existing, entry,
                        uriExtractor.getVariantKey(req, entry),
View Full Code Here


        final String parentCacheKey = uriExtractor.getURI(target, req);
        final HttpCacheEntry entry = variant.getEntry();
        final String variantKey = uriExtractor.getVariantKey(req, entry);
        final String variantCacheKey = variant.getCacheKey();

        final HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
            public HttpCacheEntry update(final HttpCacheEntry existing)
                    throws IOException {
                return doGetUpdatedParentEntry(req.getRequestLine().getUri(),
                        existing, entry, variantKey, variantCacheKey);
            }
View Full Code Here

        final String url = "foo";
        final String key = "key";
        final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
        final byte[] serialized = HttpTestUtils.getRandomBytes(128);

        HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
            public HttpCacheEntry update(HttpCacheEntry old) {
                assertNull(old);
                return updatedValue;
            }
        };
View Full Code Here

        final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
        final byte[] oldBytes = HttpTestUtils.getRandomBytes(128);
        final CASValue<Object> casValue = new CASValue<Object>(-1, oldBytes);
        final byte[] newBytes = HttpTestUtils.getRandomBytes(128);

        HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
            public HttpCacheEntry update(HttpCacheEntry old) {
                assertNull(old);
                return updatedValue;
            }
        };
View Full Code Here

        final byte[] oldBytes = HttpTestUtils.getRandomBytes(128);
        CASValue<Object> casValue = new CASValue<Object>(1, oldBytes);
        final byte[] newBytes = HttpTestUtils.getRandomBytes(128);
       

        HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
            public HttpCacheEntry update(HttpCacheEntry old) {
                assertSame(existingValue, old);
                return updatedValue;
            }
        };
View Full Code Here

        CacheConfig config = new CacheConfig();
        config.setMaxUpdateRetries(0);
        impl = new MemcachedHttpCacheStorage(mockMemcachedClient, config,
                mockMemcachedCacheEntryFactory, mockKeyHashingScheme);

        HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
            public HttpCacheEntry update(HttpCacheEntry old) {
                assertSame(existingValue, old);
                return updatedValue;
            }
        };
View Full Code Here

        CASValue<Object> casValue = new CASValue<Object>(1, oldBytes);
        CASValue<Object> casValue2 = new CASValue<Object>(2, oldBytes2);
        final byte[] newBytes = HttpTestUtils.getRandomBytes(128);
        final byte[] newBytes2 = HttpTestUtils.getRandomBytes(128);

        HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
            public HttpCacheEntry update(HttpCacheEntry old) {
                if (old == existingValue) return updatedValue;
                assertSame(existingValue2, old);
                return updatedValue2;
            }
View Full Code Here

            HttpCacheUpdateException {
        final String url = "foo";
        final String key = "key";
        final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();

        HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
            public HttpCacheEntry update(HttpCacheEntry old) {
                assertNull(old);
                return updatedValue;
            }
        };
View Full Code Here

        final String key = "foo";
        final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();

        final Element element = new Element(key, new byte[]{});

        final HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback(){
            @Override
            public HttpCacheEntry update(final HttpCacheEntry old){
                assertNull(old);
                return updatedValue;
            }
View Full Code Here

        final HttpCacheEntry existingValue = HttpTestUtils.makeCacheEntry();
        final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();

        final Element existingElement = new Element(key, new byte[]{});

        final HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback(){
            @Override
            public HttpCacheEntry update(final HttpCacheEntry old){
                assertEquals(existingValue, old);
                return updatedValue;
            }
View Full Code Here

TOP

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

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.