@Override
protected PageInfo buildPageInfo(HttpServletRequest request,
HttpServletResponse response, FilterChain chain) throws Exception {
// Look up the cached page
final String key = prepareCache(request);
PageInfo pageInfo = null;
try {
// check clear cache
clearCache(request);
//
Element element = blockingCache.get(key);
if (element == null || element.getObjectValue() == null) {
try {
// Page is not cached - build the response, cache it, and
// send to client
pageInfo = buildPage(request, response, chain);
if (pageInfo.isOk() && pageInfo.getTimeToLiveSeconds()>=0) {
blockingCache.put(new Element(key, pageInfo, false,
(int)pageInfo.getTimeToLiveSeconds(), (int)pageInfo.getTimeToLiveSeconds()));
logger.debug("Cache widget {} {} seconds ",
getWidgetConfig(request).getName(), getWidgetConfig(request).getCache());
} else {
blockingCache.put(new Element(key, null));
}