use of lucee.runtime.cache.legacy.CacheItem in project Lucee by lucee.
the class Cache method doServerCache.
private void doServerCache() throws IOException, PageException {
if (hasBody)
hasBody = !StringUtil.isEmpty(body);
// call via cfcache disable debugger output
if (pageContext.getConfig().debug())
pageContext.getDebugger().setOutput(false);
HttpServletResponse rsp = pageContext.getHttpServletResponse();
// generate cache resource matching request object
CacheItem ci = generateCacheResource(null, false);
// use cached resource
if (ci.isValid(timespan)) {
// if(isOK(cacheResource)){
if (pageContext.getHttpServletResponse().isCommitted())
return;
OutputStream os = null;
try {
ci.writeTo(os = getOutputStream(), ReqRspUtil.getCharacterEncoding(pageContext, rsp).name());
// IOUtil.copy(is=cacheResource.getInputStream(),os=getOutputStream(),false,false);
} finally {
IOUtil.flushEL(os);
IOUtil.closeEL(os);
((PageContextImpl) pageContext).getRootOut().setClosed(true);
}
throw new Abort(Abort.SCOPE_REQUEST);
}
// call page again and
// MetaData.getInstance(getDirectory()).add(ci.getName(), ci.getRaw());
PageContextImpl pci = (PageContextImpl) pageContext;
pci.getRootOut().doCache(ci);
}
Aggregations