tried to make last_modified recognition smarter

pull/1/head
Michael Peter Christen 11 years ago
parent 2d03037965
commit 53948da7d0

@ -492,7 +492,7 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Stri
protected Date headerDate(final String kind) {
if (containsKey(kind)) {
Date parsedDate = parseHTTPDate(get(kind));
if (parsedDate == null) parsedDate = new Date();
if (parsedDate == null) return null;
return parsedDate;
}
return null;

@ -84,7 +84,8 @@ public class ResponseHeader extends HeaderFramework {
public Date lastModified() {
if (this.date_cache_LastModified != null) return this.date_cache_LastModified;
final Date d = headerDate(HeaderFramework.LAST_MODIFIED);
Date d = headerDate(HeaderFramework.LAST_MODIFIED);
if (d == null) d = date();
final Date now = new Date();
this.date_cache_LastModified = (d == null) ? date() : d.after(now) ? now : d;
return this.date_cache_LastModified;

@ -529,6 +529,7 @@ public class Segment {
// STORE URL TO LOADED-URL-DB
Date modDate = responseHeader == null ? new Date() : responseHeader.lastModified();
if (modDate == null) modDate = new Date();
if (modDate.getTime() > loadDate.getTime()) modDate = loadDate;
char docType = Response.docType(document.dc_format());

@ -468,6 +468,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
if (allAttr || contains(CollectionSchema.content_type)) add(doc, CollectionSchema.content_type, new String[]{document.dc_format()});
if (allAttr || contains(CollectionSchema.last_modified)) {
Date lastModified = responseHeader == null ? new Date() : responseHeader.lastModified();
if (lastModified == null) lastModified = new Date();
if (document.getDate().before(lastModified)) lastModified = document.getDate();
add(doc, CollectionSchema.last_modified, lastModified);
}

Loading…
Cancel
Save