String base64Key = request.getParameter("key");
if (logger.isDebugEnabled()) {
logger.debug("Retrieving key " + base64Key) ;
}
if (base64Key != null) {
CSSCacheIdentity identity = new CSSCacheIdentity(base64Key);
if (logger.isDebugEnabled()) {
logger.debug("Key createTime is " + identity.getCreateTime());
logger.debug("Key sequenceNo is " + identity.getSequenceNo());
}
CSSCacheEntry entity = (CSSCacheEntry) cssCache.retrieve(identity);
if (entity != null) {
response.setContentType("text/css");
// Set caching HTTP headers.
long nowTime = System.currentTimeMillis();
long createTime = identity.getCreateTime();
long expiresTime = identity.getExpiresTime();
// Calculate max-age, avoiding negative values.
long maxAgeSeconds = Math.max ((expiresTime - nowTime) / 1000, 0);
// Set HTTP 1.1 headers