/** * Returns true if computeFreshnessLifetime used a heuristic. If we used a heuristic to serve a * cached response older than 24 hours, we are required to attach a warning. */ private boolean isFreshnessLifetimeHeuristic() { return cacheResponse.cacheControl().maxAgeSeconds() == -1 && expires == null; }
/** * Returns the number of milliseconds that the response was fresh for, starting from the served * date. */ private long computeFreshnessLifetime() { CacheControl responseCaching = cacheResponse.cacheControl(); if (responseCaching.maxAgeSeconds() != -1) { return SECONDS.toMillis(responseCaching.maxAgeSeconds()); } else if (expires != null) { long servedMillis = servedDate != null ? servedDate.getTime() : receivedResponseMillis; long delta = expires.getTime() - servedMillis; return delta > 0 ? delta : 0; } else if (lastModified != null && cacheResponse.request().url().query() == null) { // As recommended by the HTTP RFC and implemented in Firefox, the // max age of a document should be defaulted to 10% of the // document's age at the time it was served. Default expiration // dates aren't used for URIs containing a query. long servedMillis = servedDate != null ? servedDate.getTime() : sentRequestMillis; long delta = servedMillis - lastModified.getTime(); return delta > 0 ? (delta / 10) : 0; } return 0; }
/** * Returns true if computeFreshnessLifetime used a heuristic. If we used a heuristic to serve a * cached response older than 24 hours, we are required to attach a warning. */ private boolean isFreshnessLifetimeHeuristic() { return cacheResponse.cacheControl().maxAgeSeconds() == -1 && expires == null; }
/** * Returns the number of milliseconds that the response was fresh for, starting from the served * date. */ private long computeFreshnessLifetime() { CacheControl responseCaching = cacheResponse.cacheControl(); if (responseCaching.maxAgeSeconds() != -1) { return SECONDS.toMillis(responseCaching.maxAgeSeconds()); } else if (expires != null) { long servedMillis = servedDate != null ? servedDate.getTime() : receivedResponseMillis; long delta = expires.getTime() - servedMillis; return delta > 0 ? delta : 0; } else if (lastModified != null && cacheResponse.request().url().query() == null) { // As recommended by the HTTP RFC and implemented in Firefox, the // max age of a document should be defaulted to 10% of the // document's age at the time it was served. Default expiration // dates aren't used for URIs containing a query. long servedMillis = servedDate != null ? servedDate.getTime() : sentRequestMillis; long delta = servedMillis - lastModified.getTime(); return delta > 0 ? (delta / 10) : 0; } return 0; }
|| response.cacheControl().maxAgeSeconds() != -1 || response.cacheControl().isPublic() || response.cacheControl().isPrivate()) {
long freshMillis = computeFreshnessLifetime(); if (requestCaching.maxAgeSeconds() != -1) { freshMillis = Math.min(freshMillis, SECONDS.toMillis(requestCaching.maxAgeSeconds()));
|| response.cacheControl().maxAgeSeconds() != -1 || response.cacheControl().isPublic() || response.cacheControl().isPrivate()) {
long freshMillis = computeFreshnessLifetime(); if (requestCaching.maxAgeSeconds() != -1) { freshMillis = Math.min(freshMillis, SECONDS.toMillis(requestCaching.maxAgeSeconds()));
/** * Returns true if computeFreshnessLifetime used a heuristic. If we used a * heuristic to serve a cached response older than 24 hours, we are required * to attach a warning. */ private boolean isFreshnessLifetimeHeuristic() { return cacheResponse.cacheControl().maxAgeSeconds() == -1 && expires == null; }
/** * Returns true if computeFreshnessLifetime used a heuristic. If we used a * heuristic to serve a cached response older than 24 hours, we are required * to attach a warning. */ private boolean isFreshnessLifetimeHeuristic() { return cacheResponse.cacheControl().maxAgeSeconds() == -1 && expires == null; }
/** * Returns true if computeFreshnessLifetime used a heuristic. If we used a heuristic to serve a * cached response older than 24 hours, we are required to attach a warning. */ private boolean isFreshnessLifetimeHeuristic() { return cacheResponse.cacheControl().maxAgeSeconds() == -1 && expires == null; }
/** * Returns true if computeFreshnessLifetime used a heuristic. If we used a heuristic to serve a * cached response older than 24 hours, we are required to attach a warning. */ private boolean isFreshnessLifetimeHeuristic() { return cacheResponse.cacheControl().maxAgeSeconds() == -1 && expires == null; }
/** * Returns true if computeFreshnessLifetime used a heuristic. If we used a heuristic to serve a * cached response older than 24 hours, we are required to attach a warning. */ private boolean isFreshnessLifetimeHeuristic() { return cacheResponse.cacheControl().maxAgeSeconds() == -1 && expires == null; }
/** * Returns the number of milliseconds that the response was fresh for, * starting from the served date. */ private long computeFreshnessLifetime() { CacheControl responseCaching = cacheResponse.cacheControl(); if (responseCaching.maxAgeSeconds() != -1) { return SECONDS.toMillis(responseCaching.maxAgeSeconds()); } else if (expires != null) { long servedMillis = servedDate != null ? servedDate.getTime() : receivedResponseMillis; long delta = expires.getTime() - servedMillis; return delta > 0 ? delta : 0; } else if (lastModified != null && cacheResponse.request().url().query() == null) { // As recommended by the HTTP RFC and implemented in Firefox, the // max age of a document should be defaulted to 10% of the // document's age at the time it was served. Default expiration // dates aren't used for URIs containing a query. long servedMillis = servedDate != null ? servedDate.getTime() : sentRequestMillis; long delta = servedMillis - lastModified.getTime(); return delta > 0 ? (delta / 10) : 0; } return 0; }
/** * Returns the number of milliseconds that the response was fresh for, * starting from the served date. */ private long computeFreshnessLifetime() { CacheControl responseCaching = cacheResponse.cacheControl(); if (responseCaching.maxAgeSeconds() != -1) { return SECONDS.toMillis(responseCaching.maxAgeSeconds()); } else if (expires != null) { long servedMillis = servedDate != null ? servedDate.getTime() : receivedResponseMillis; long delta = expires.getTime() - servedMillis; return delta > 0 ? delta : 0; } else if (lastModified != null && cacheResponse.request().url().query() == null) { // As recommended by the HTTP RFC and implemented in Firefox, the // max age of a document should be defaulted to 10% of the // document's age at the time it was served. Default expiration // dates aren't used for URIs containing a query. long servedMillis = servedDate != null ? servedDate.getTime() : sentRequestMillis; long delta = servedMillis - lastModified.getTime(); return delta > 0 ? (delta / 10) : 0; } return 0; }
/** * Returns the number of milliseconds that the response was fresh for, starting from the served * date. */ private long computeFreshnessLifetime() { CacheControl responseCaching = cacheResponse.cacheControl(); if (responseCaching.maxAgeSeconds() != -1) { return SECONDS.toMillis(responseCaching.maxAgeSeconds()); } else if (expires != null) { long servedMillis = servedDate != null ? servedDate.getTime() : receivedResponseMillis; long delta = expires.getTime() - servedMillis; return delta > 0 ? delta : 0; } else if (lastModified != null && cacheResponse.request().url().query() == null) { // As recommended by the HTTP RFC and implemented in Firefox, the // max age of a document should be defaulted to 10% of the // document's age at the time it was served. Default expiration // dates aren't used for URIs containing a query. long servedMillis = servedDate != null ? servedDate.getTime() : sentRequestMillis; long delta = servedMillis - lastModified.getTime(); return delta > 0 ? (delta / 10) : 0; } return 0; }
/** * Returns the number of milliseconds that the response was fresh for, starting from the served * date. */ private long computeFreshnessLifetime() { CacheControl responseCaching = cacheResponse.cacheControl(); if (responseCaching.maxAgeSeconds() != -1) { return SECONDS.toMillis(responseCaching.maxAgeSeconds()); } else if (expires != null) { long servedMillis = servedDate != null ? servedDate.getTime() : receivedResponseMillis; long delta = expires.getTime() - servedMillis; return delta > 0 ? delta : 0; } else if (lastModified != null && cacheResponse.request().url().query() == null) { // As recommended by the HTTP RFC and implemented in Firefox, the // max age of a document should be defaulted to 10% of the // document's age at the time it was served. Default expiration // dates aren't used for URIs containing a query. long servedMillis = servedDate != null ? servedDate.getTime() : sentRequestMillis; long delta = servedMillis - lastModified.getTime(); return delta > 0 ? (delta / 10) : 0; } return 0; }
/** * Returns the number of milliseconds that the response was fresh for, starting from the served * date. */ private long computeFreshnessLifetime() { CacheControl responseCaching = cacheResponse.cacheControl(); if (responseCaching.maxAgeSeconds() != -1) { return SECONDS.toMillis(responseCaching.maxAgeSeconds()); } else if (expires != null) { long servedMillis = servedDate != null ? servedDate.getTime() : receivedResponseMillis; long delta = expires.getTime() - servedMillis; return delta > 0 ? delta : 0; } else if (lastModified != null && cacheResponse.request().url().query() == null) { // As recommended by the HTTP RFC and implemented in Firefox, the // max age of a document should be defaulted to 10% of the // document's age at the time it was served. Default expiration // dates aren't used for URIs containing a query. long servedMillis = servedDate != null ? servedDate.getTime() : sentRequestMillis; long delta = servedMillis - lastModified.getTime(); return delta > 0 ? (delta / 10) : 0; } return 0; }
|| response.cacheControl().maxAgeSeconds() != -1 || response.cacheControl().isPublic() || response.cacheControl().isPrivate()) {
|| response.cacheControl().maxAgeSeconds() != -1 || response.cacheControl().isPublic() || response.cacheControl().isPrivate()) {