APISonar


org.apache.hc.core5.http.HttpHeaders.DATE

> org > apache > hc > core5 > http > HttpHeaders > DATE
org APIs apache APIs hc APIs core5 APIs http APIs HttpHeaders APIs DATE APIs

Example 1
private void ensure206ContainsDateHeader(final HttpResponse response) {
        if (response.getFirstHeader(HttpHeaders.DATE) == null) {
            response.addHeader(HttpHeaders.DATE, DateUtils.formatDate(new Date()));
        }

    }
Example 2
public void testDateParseMessage() throws Exception {
        final HeaderGroup message1 = new HeaderGroup();
        message1.setHeader(new BasicHeader(HttpHeaders.DATE, "Fri, 14 Oct 2005 00:00:00 GMT"));
        Assert.assertEquals(createDate(2005, Calendar.OCTOBER, 14), DateUtils.parseDate(message1, HttpHeaders.DATE));

        final HeaderGroup message2 = new HeaderGroup();
        message2.addHeader(new BasicHeader(HttpHeaders.DATE, "Fri, 14 Oct 2005 00:00:00 GMT"));
        message2.addHeader(new BasicHeader(HttpHeaders.DATE, "Fri, 21 Oct 2005 00:00:00 GMT"));
        Assert.assertEquals(createDate(2005, Calendar.OCTOBER, 14), DateUtils.parseDate(message2, HttpHeaders.DATE));
    }
Example 3
boolean revalidationResponseIsTooOld(final HttpResponse backendResponse, final HttpCacheEntry cacheEntry) {
        // either backend response or cached entry did not have a valid
        // Date header, so we can't tell if they are out of order
        // according to the origin clock; thus we can skip the
        // unconditional retry recommended in 13.2.6 of RFC 2616.
        return DateUtils.isBefore(backendResponse, cacheEntry, HttpHeaders.DATE);
    }