@Test public void testHEADWithETagAndGETWithItemInCache() throws IOException { HTTPRequest request = new HTTPRequest(REQUEST_URI, HTTPMethod.HEAD); Headers headers = new Headers(); headers = headers.add(new Header("ETag", "\"foo\"")); headers = headers.add(HeaderUtils.toHttpDate(HeaderConstants.DATE, LocalDateTime.now())); HTTPResponse cachedResponse = new HTTPResponse(createClosedPayload(), Status.OK, headers); when(cacheStorage.get(isA(HTTPRequest.class))).thenReturn(new DefaultCacheItem(cachedResponse) { @Override public boolean isStale(LocalDateTime requestTime) { return false; } }); HTTPResponse response = cache.execute(request); assertEquals("Conditionals was set, incorrect", 0, request.getHeaders().getConditionals().toHeaders().size()); assertFalse(response.hasPayload()); response = doGet(new Headers(), Status.OK, 1); assertTrue("No payload on get", response.hasPayload()); when(cacheStorage.size()).thenReturn(1); assertEquals(1, cacheStorage.size()); }
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);  }