SOLR-496 - use Long for Cache-Control max-age

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@634072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2008-03-05 22:48:54 +00:00
parent 51f1319500
commit 9e781737c6
3 changed files with 9 additions and 6 deletions

View File

@ -289,6 +289,9 @@ Bug Fixes
18. SOLR-324: Add proper support for Long and Doubles in sorting, etc. (gsingers)
19. SOLR-496: Cache-Control max-age changed to Long so Expires
calculation won't cause overflow. (Thomas Peuss via hossman)
Other Changes
1. SOLR-135: Moved common classes to org.apache.solr.common and altered the
build scripts to make two jars: apache-solr-1.3.jar and

View File

@ -226,7 +226,7 @@ public class SolrConfig extends Config {
private final boolean never304;
private final String etagSeed;
private final String cacheControlHeader;
private final Integer maxAge;
private final Long maxAge;
private final LastModFrom lastModFrom;
private HttpCachingConfig(SolrConfig conf) {
@ -241,13 +241,13 @@ public class SolrConfig extends Config {
cacheControlHeader = conf.get(CACHE_PRE+"cacheControl",null);
Integer tmp = null; // maxAge
Long tmp = null; // maxAge
if (null != cacheControlHeader) {
try {
final Matcher ttlMatcher = MAX_AGE.matcher(cacheControlHeader);
final String ttlStr = ttlMatcher.find() ? ttlMatcher.group(1) : null;
tmp = (null != ttlStr && !"".equals(ttlStr))
? Integer.valueOf(ttlStr)
? Long.valueOf(ttlStr)
: null;
} catch (Exception e) {
log.log(Level.WARNING,
@ -265,7 +265,7 @@ public class SolrConfig extends Config {
/** null if no Cache-Control header */
public String getCacheControlHeader() { return cacheControlHeader; }
/** null if no max age limitation */
public Integer getMaxAge() { return maxAge; }
public Long getMaxAge() { return maxAge; }
public LastModFrom getLastModFrom() { return lastModFrom; }
}
}

View File

@ -175,10 +175,10 @@ public final class HttpCacheHeaderUtil {
if (null != cc) {
resp.setHeader("Cache-Control", cc);
}
Integer maxAge = conf.getHttpCachingConfig().getMaxAge();
Long maxAge = conf.getHttpCachingConfig().getMaxAge();
if (null != maxAge) {
resp.setDateHeader("Expires", System.currentTimeMillis()
+ (maxAge * 1000));
+ (maxAge * 1000L));
}
return;