Example usage for org.apache.http.impl.cookie DateUtils PATTERN_RFC1123

List of usage examples for org.apache.http.impl.cookie DateUtils PATTERN_RFC1123

Introduction

In this page you can find the example usage for org.apache.http.impl.cookie DateUtils PATTERN_RFC1123.

Prototype

String PATTERN_RFC1123

To view the source code for org.apache.http.impl.cookie DateUtils PATTERN_RFC1123.

Click Source Link

Document

Date format pattern used to parse HTTP date headers in RFC 1123 format.

Usage

From source file:android.webkit.cts.TestWebServer.java

private void setDateHeaders(HttpResponse response) {
    response.addHeader("Date", DateUtils.formatDate(new Date(), DateUtils.PATTERN_RFC1123));
}

From source file:android.webkit.cts.CtsTestServer.java

private void setDateHeaders(HttpResponse response) {
    long time = System.currentTimeMillis();
    synchronized (this) {
        if (mDocValidity != 0) {
            String expires = DateUtils.formatDate(new Date(time + mDocValidity), DateUtils.PATTERN_RFC1123);
            response.addHeader("Expires", expires);
        }//from  w  ww.  j a  va 2 s .  c om
        if (mDocAge != 0) {
            String modified = DateUtils.formatDate(new Date(time - mDocAge), DateUtils.PATTERN_RFC1123);
            response.addHeader("Last-Modified", modified);
        }
    }
    response.addHeader("Date", DateUtils.formatDate(new Date(), DateUtils.PATTERN_RFC1123));
}