예제 #1
0
  /**
   * {@inheritDoc}
   *
   * @param request {@inheritDoc}
   * @param response {@inheritDoc}
   * @param chain {@inheritDoc}
   * @return {@inheritDoc}
   * @throws AlreadyGzippedException {@inheritDoc}
   * @throws Exception {@inheritDoc}
   */
  protected PageInfo buildPage(
      final HttpServletRequest request, final HttpServletResponse response, final 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();

    // Return the page info
    return new PageInfo(
        wrapper.getStatus(),
        wrapper.getContentType(),
        wrapper.getHeaders(),
        wrapper.getCookies(),
        outstr.toByteArray(),
        false);
  }