protected PageInfo buildPage(HttpServletRequest request,
HttpServletResponse response, FilterChain chain)
throws AlreadyGzippedException, Exception {
// Invoke the next entity in the chain
final ByteArrayOutputStream outstr = new ByteArrayOutputStream();
final GenericResponseWrapper wrapper = new GenericResponseWrapper(response, outstr);
chain.doFilter(request, wrapper);
wrapper.flush();
//
WidgetConfig widgetConfig = (WidgetConfig) request
.getAttribute(WidgetConfig.KEY);
Long timeToLiveSeconds = parseTimeToLiveSeconds(widgetConfig.getCache());
// Return the page info
return new PageInfo(wrapper.getStatus(), wrapper.getContentType(),
wrapper.getCookies(),
outstr.toByteArray(), false, timeToLiveSeconds, wrapper.getAllHeaders());
}