If this time is {@link #NEVER} then this method will fail asit does not know how to map it to a simple number of milliseconds.
141142143144145146147148149150151
if (lastModified != null) { final String lastModifiedAsString; // SimpleDateFormat is not thread safe synchronized (RFC1123) { lastModifiedAsString = RFC1123.format( new Date(lastModified.inMillis())); } final Header header = new HeaderImpl(HeaderNames.IF_MODIFIED_SINCE_HEADER); header.setValue(lastModifiedAsString); executor.addRequestHeader(header);
205206207208209210211212213214215
// SimpleDateFormat is not thread safe so create a // new instance DateFormat RFC1123 = DateFormats.RFC_1123_GMT.create(); lastModifiedAsString = RFC1123.format( new Date(lastModified.inMillis())); method.setRequestHeader(HEADER_IF_MODIFIED_SINCE, lastModifiedAsString); }
579580581582583584585586587588589
cachingDirectives.getExpires() != null) { // if enabled, set Expires, Cache-Control/max-age and Vary response // headers final Time expires = cachingDirectives.getExpires(); if (expires != Time.NEVER) { response.addDateHeader("Expires", expires.inMillis()); // compute max-age value final Period timeToLive = cachingDirectives.getTimeToLive(); long maxAgeInSeconds = 0; if (timeToLive != null) { maxAgeInSeconds =