Package com.volantis.shared.net.url.http

Examples of com.volantis.shared.net.url.http.CachedHttpContent


            httpContent = new HTTPResponseAccessorWrapper(accessor);
            final int statusCode = accessor.getStatusCode();
            if (isStatusCodeCachable(statusCode)) {
                state = builder.build();
                if (state != null && state.isCacheable()) {
                    httpContent = new CachedHttpContent(httpContent, state, clock,
                        new CacheableDependency(key, state, clock,
                            cache, this));
                    cacheable = true;
                }
            } else if (statusCode == 304) {
                // 304 Not Modified
                // it is only possible if it is a revalidation cache entry holds
                // the exisiting cache config as an extension object
                state = builder.merge(
                    ((CachedHttpContentState) entry.getExtensionObject()));
                cacheable = state.isCacheable();
                // entry must have a CachedHttpContent
                final CachedHttpContent originalContent =
                    (CachedHttpContent) entry.getValue();
                originalContent.combineHeaders(httpContent, state);
                httpContent = originalContent;
            }

            result = new ProviderResult(httpContent, group, cacheable, state);
        } catch (Throwable e) {
View Full Code Here


                final HttpContent returnedContent =
                    new HttpClientHttpContent(method);
                if (!cacheState.isCacheable()) {
                    content = returnedContent;
                } else {
                    content = new CachedHttpContent(
                        returnedContent, cacheState, clock,
                        new CacheableDependency(url, cacheState, clock, cache,
                            CachingObjectProvider.this));
                }
            } else if (statusCode == HttpStatus.SC_NOT_MODIFIED) {
                // not modified, so it is OK to get the content from the cache
                final CachedHttpContent cachedContent =
                    (CachedHttpContent) entry.getValue();
                // 304 Not Modified is only possible if it is a revalidation
                // cache entry holds the exisiting cache config as an
                // extension object
                cacheState = builder.merge(
                    ((CachedHttpContentState) entry.getExtensionObject()));
                cachedContent.combineHeaders(
                    new HttpClientHttpContent(method), cacheState);
                content = cachedContent;
            } else {
                method.releaseConnection();
                throw new IOException("Unexpected status code - " + statusCode);
View Full Code Here

TOP

Related Classes of com.volantis.shared.net.url.http.CachedHttpContent

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.