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);