exchange.setResponseCode(StatusCodes.FORBIDDEN);
exchange.endExchange();
return;
}
ResponseCache cache = exchange.getAttachment(ResponseCache.ATTACHMENT_KEY);
final boolean cachable = this.cachable.resolve(exchange);
//we set caching headers before we try and serve from the cache
if (cachable && cacheTime != null) {
exchange.getResponseHeaders().put(Headers.CACHE_CONTROL, "public, max-age=" + cacheTime);
if (System.currentTimeMillis() > lastExpiryDate) {
long date = System.currentTimeMillis();
lastExpiryHeader = DateUtils.toDateString(new Date(date));
lastExpiryDate = date;
}
exchange.getResponseHeaders().put(Headers.EXPIRES, lastExpiryHeader);
}
if (cache != null && cachable) {
if (cache.tryServeResponse()) {
return;
}
}