private ParsedHeaders(Headers headers) { for (int i = 0; i < headers.size(); i++) { String fieldName = headers.name(i); String value = headers.value(i); if ("Last-Modified".equalsIgnoreCase(fieldName)) { lastModified = HttpDate.parse(value); } else if ("Vary".equalsIgnoreCase(fieldName)) { // Replace the immutable empty set with something we can mutate. if (varyFields.isEmpty()) { varyFields = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); } for (String varyField : value.split(",")) { varyFields.add(varyField.trim()); } } } }
public void setIfModifiedSince(long newValue) { super.setIfModifiedSince(newValue); if (this.ifModifiedSince != 0) { this.requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(this .ifModifiedSince))); } else { this.requestHeaders.removeAll("If-Modified-Since"); } }
public final Date getDate(String paramString) { String str = get(paramString); if (str != null) { return HttpDate.parse(str); } return null; }
@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"); } }
public Date getDate(String name) { String value = get(name); return value != null ? HttpDate.parse(value) : null; }
/** * Returns the last value corresponding to the specified field parsed as an * HTTP date, or null if either the field is absent or cannot be parsed as a * date. */ public Date getDate(String name) { String value = get(name); return value != null ? HttpDate.parse(value) : null; }