{
_key=pathInContext;
_resource=resource;
String contentType = _mimeTypes.getMimeByExtension(_resource.toString());
_contentType=contentType==null?null:new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,contentType);
_characterEncoding = _contentType==null?null:MimeTypes.getCharsetFromContentType(contentType);
_mimeType = _contentType==null?null:MimeTypes.CACHE.get(MimeTypes.getContentTypeWithoutCharset(contentType));
boolean exists=resource.exists();
_lastModifiedValue=exists?resource.lastModified():-1L;
_lastModified=_lastModifiedValue==-1?null
:new PreEncodedHttpField(HttpHeader.LAST_MODIFIED,DateGenerator.formatDate(_lastModifiedValue));
_contentLengthValue=exists?(int)resource.length():0;
_contentLength=new PreEncodedHttpField(HttpHeader.CONTENT_LENGTH,Long.toString(_contentLengthValue));
_cachedSize.addAndGet(_contentLengthValue);
_cachedFiles.incrementAndGet();
_lastAccessed=System.currentTimeMillis();
_etag=ResourceCache.this._etagSupported?new PreEncodedHttpField(HttpHeader.ETAG,resource.getWeakETag()):null;
}