@Test public void testConditionalGet() throws IOException { HTTPRequest request = new HTTPRequest(URI.create("foo")); LocalDateTime prev = LocalDateTime.now(); Headers responseHeaders = new Headers(); responseHeaders = responseHeaders.add(HeaderUtils.toHttpDate(HeaderConstants.DATE, prev)); responseHeaders = responseHeaders.add(new Header(HeaderConstants.CACHE_CONTROL, "private, max-age=60")); responseHeaders = responseHeaders.add(new Header(HeaderConstants.ETAG, "\"1234\"")); when(cacheStorage.get(isA(HTTPRequest.class))).thenReturn(new DefaultCacheItem(new HTTPResponse(createClosedPayload(), Status.OK, responseHeaders))); Headers updatedHeaders = new Headers(responseHeaders); updatedHeaders = updatedHeaders.add(HeaderUtils.toHttpDate(HeaderConstants.DATE, prev.plusMinutes(2))); when(responseResolver.resolve(isA(HTTPRequest.class))).thenReturn(new HTTPResponse(Status.NOT_MODIFIED, updatedHeaders)); HTTPResponse response = cache.execute(request); Assert.assertNotNull("Response was null", response); Assert.assertTrue("The payload was null", response.getPayload().isPresent()); Assert.assertNotNull("The payload had a null inputstream", response.getPayload().get().getInputStream()); }
public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); }
HTTPCache { public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); } }
HTTPCache { public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); } HTTPCache(CacheStorage storage, ResponseResolver resolver); }
HTTPCache { public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); } HTTPCache(CacheStorage storage, ResponseResolver resolver); void clear(); CacheStorage getStorage(); ResponseResolver getResolver(); CacheStatistics getStatistics(); HTTPResponse execute(final HTTPRequest request); HTTPResponse executeRefresh(final HTTPRequest request); void shutdown(); boolean isTranslateHEADToGET(); void setTranslateHEADToGET(boolean translateHEADToGET); }
HTTPCache { public HTTPResponse execute(final HTTPRequest request) { return execute(request, helper.isEndToEndReloadRequest(request)); } HTTPCache(CacheStorage storage, ResponseResolver resolver); void clear(); CacheStorage getStorage(); ResponseResolver getResolver(); CacheStatistics getStatistics(); HTTPResponse execute(final HTTPRequest request); HTTPResponse executeRefresh(final HTTPRequest request); void shutdown(); boolean isTranslateHEADToGET(); void setTranslateHEADToGET(boolean translateHEADToGET);  }