/** * return {@code true} if capture's timestamp matches exactly what's requested. * If requested timestamp is less specific (i.e. less digits) than capture's * timestamp, it is considered non-matching. On the other hand, capture's * timestamp being prefix of requested timestamp is considered a match (this is * to support captures with timestamp shorter than 14-digits. this may change). * @param closest capture to check * @param wbRequest request object * @return {@code true} if match */ private static boolean timestampMatch(CaptureSearchResult closest, WaybackRequest wbRequest) { String replayTimestamp = wbRequest.getReplayTimestamp(); String captureTimestamp = closest.getCaptureTimestamp(); if (replayTimestamp.length() < captureTimestamp.length()) return false; if (replayTimestamp.startsWith(captureTimestamp)) return true; // if looking for latest date, consider it a tentative match, until // checking if it's replay-able. if (wbRequest.isBestLatestReplayRequest()) return true; return false; }
/** * return {@code true} if capture's timestamp matches exactly what's requested. * If requested timestamp is less specific (i.e. less digits) than capture's * timestamp, it is considered non-matching. On the other hand, capture's * timestamp being prefix of requested timestamp is considered a match (this is * to support captures with timestamp shorter than 14-digits. this may change). * @param closest capture to check * @param wbRequest request object * @return {@code true} if match */ private static boolean timestampMatch(CaptureSearchResult closest, WaybackRequest wbRequest) { String replayTimestamp = wbRequest.getReplayTimestamp(); String captureTimestamp = closest.getCaptureTimestamp(); if (replayTimestamp.length() < captureTimestamp.length()) return false; if (replayTimestamp.startsWith(captureTimestamp)) return true; // if looking for latest date, consider it a tentative match, until // checking if it's replay-able. if (wbRequest.isBestLatestReplayRequest()) return true; return false; }
wbRequest.isBestLatestReplayRequest() && !currentClosest.isHttpSuccess()) { CaptureSearchResult capture;
wbRequest.isBestLatestReplayRequest() && !currentClosest.isHttpSuccess()) { CaptureSearchResult capture;
if (wbRequest.isBestLatestReplayRequest()) { statusFilter = "statuscode:[23]..";
if (wbRequest.isBestLatestReplayRequest()) { statusFilter = "statuscode:[23]..";
protected void checkPathDateless(WaybackRequest wbr, String requestUrl) { assertNotNull(wbr); assertTrue(wbr.isReplayRequest()); assertTrue(wbr.isBestLatestReplayRequest()); assertEquals(EXPECTED_START_TIMESTAMP, wbr.getStartTimestamp()); assertEquals(EXPECTED_END_TIMESTAMP, wbr.getEndTimestamp()); assertEquals(requestUrl, wbr.getRequestUrl()); assertNotNull(wbr.getReplayDate()); assertNotNull(wbr.getAnchorDate()); }
assertTrue(wbr.isReplayRequest()); assertTrue(wbr.isMementoTimegate()); assertFalse(wbr.isBestLatestReplayRequest()); assertEquals(EXPECTED_START_TIMESTAMP, wbr.getStartTimestamp()); assertEquals(EXPECTED_END_TIMESTAMP, wbr.getEndTimestamp()); assertNotNull(wbr); assertTrue(wbr.isReplayRequest()); assertFalse(wbr.isBestLatestReplayRequest()); assertEquals(EXPECTED_START_TIMESTAMP, wbr.getStartTimestamp()); assertEquals(EXPECTED_END_TIMESTAMP, wbr.getEndTimestamp()); assertNotNull(wbr); assertTrue(wbr.isReplayRequest()); assertTrue(wbr.isBestLatestReplayRequest()); assertEquals(EXPECTED_START_TIMESTAMP, wbr.getStartTimestamp()); assertEquals(EXPECTED_END_TIMESTAMP, wbr.getEndTimestamp());