/** * Add a header with the specified name and formatted date. Does validation of header names and * value. */ public Builder add(String name, Date value) { if (value == null) throw new NullPointerException("value for name " + name + " == null"); add(name, HttpDate.format(value)); return this; }
/** * Set a field with the specified date. If the field is not found, it is added. If the field is * found, the existing values are replaced. */ public Builder set(String name, Date value) { if (value == null) throw new NullPointerException("value for name " + name + " == null"); set(name, HttpDate.format(value)); return this; }
result.append("; max-age=0"); } else { result.append("; expires=").append(HttpDate.format(new Date(expiresAt)));
/** * Add a header with the specified name and formatted date. Does validation of header names and * value. */ public Builder add(String name, Date value) { if (value == null) throw new NullPointerException("value for name " + name + " == null"); add(name, HttpDate.format(value)); return this; }
/** * Set a field with the specified date. If the field is not found, it is added. If the field is * found, the existing values are replaced. */ public Builder set(String name, Date value) { if (value == null) throw new NullPointerException("value for name " + name + " == null"); set(name, HttpDate.format(value)); return this; }
@Override public void setIfModifiedSince(long newValue) { super.setIfModifiedSince(newValue); if (ifModifiedSince != 0) { requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince))); } else { requestHeaders.removeAll("If-Modified-Since"); } }
static Response withServedDateHeader(Response response) throws IOException { return response.newBuilder() .addHeader(CACHE_SERVED_DATE_HEADER, HttpDate.format(new Date())) .build(); }
result.append("; max-age=0"); } else { result.append("; expires=").append(HttpDate.format(new Date(expiresAt)));
/** * Add a header with the specified name and formatted Date. * Does validation of header names and values. */ public Builder add(String name, Date value) { if (value == null) throw new NullPointerException("value for name " + name + " == null"); add(name, HttpDate.format(value)); return this; }
/** * Set a field with the specified date. If the field is not found, it is added. If the field is * found, the existing values are replaced. */ public Builder set(String name, Date value) { if (value == null) throw new NullPointerException("value for name " + name + " == null"); set(name, HttpDate.format(value)); return this; }
result.append("; max-age=0"); } else { result.append("; expires=").append(HttpDate.format(new Date(expiresAt)));
result.append("; max-age=0"); } else { result.append("; expires=").append(HttpDate.format(new Date(expiresAt)));
result.append("; max-age=0"); } else { result.append("; expires=").append(HttpDate.format(new Date(expiresAt)));
@Override public void setIfModifiedSince(long newValue) { super.setIfModifiedSince(newValue); if (ifModifiedSince != 0) { requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince))); } else { requestHeaders.removeAll("If-Modified-Since"); } }
@Override public void setIfModifiedSince(long newValue) { super.setIfModifiedSince(newValue); if (ifModifiedSince != 0) { requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince))); } else { requestHeaders.removeAll("If-Modified-Since"); } }
@Override public void setIfModifiedSince(long newValue) { super.setIfModifiedSince(newValue); if (ifModifiedSince != 0) { requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince))); } else { requestHeaders.removeAll("If-Modified-Since"); } }