/**
   * Flush OutputStream or PrintWriter
   *
   * @throws IOException
   */
  @Override
  public void flushBuffer() throws IOException {

    // PrintWriter.flush() does not throw exception
    if (this.printWriter != null) {
      this.printWriter.flush();
    }

    IOException exception1 = null;
    try {
      if (this.gzipOutputStream != null) {
        this.gzipOutputStream.flush();
      }
    } catch (IOException e) {
      exception1 = e;
    }

    IOException exception2 = null;
    try {
      super.flushBuffer();
    } catch (IOException e) {
      exception2 = e;
    }

    if (exception1 != null) throw exception1;
    if (exception2 != null) throw exception2;
  }
  /**
   * {@inheritDoc}
   *
   * @see javax.servlet.ServletResponseWrapper#flushBuffer()
   */
  @Override
  public void flushBuffer() throws IOException {
    if (out != null) {
      out.flush();
      out.close();
      out = null;
    }

    try {
      if (isCommitted()) return;

      if (os != null) {
        // Get the buffered content
        byte[] content = os.getContent();

        // Set content-related headers
        setContentLength(content.length);

        // Write the buffered content to the underlying output stream
        super.getOutputStream().write(content);
      }

      // Flush the underlying buffer
      super.flushBuffer();

    } finally {
      os = null;
    }
  }
Example #3
0
 @Override
 public void flushBuffer() throws IOException {
   if (printWriter != null) {
     printWriter.flush();
   }
   if (outputStream != null) {
     outputStream.flush();
   }
   super.flushBuffer();
 }
  /**
   * Flush OutputStream or PrintWriter
   *
   * @throws IOException
   */
  @Override
  public void flushBuffer() throws IOException {

    // PrintWriter.flush() does not throw exception
    if (this.printWriter != null) {
      this.printWriter.flush();
    }

    if (this.gzipOutputStream != null) {
      this.gzipOutputStream.flush();
    }

    // doing this might leads to response already committed exception
    // when the PageInfo has not yet built but the buffer already flushed
    // Happens in Weblogic when a servlet forward to a JSP page and the forward
    // method trigger a flush before it forwarded to the JSP
    // disableFlushBuffer for that purpose is 'true' by default
    if (!disableFlushBuffer) {
      super.flushBuffer();
    }
  }
 /** Flushes buffer and commits response to client. */
 public void flushBuffer() throws IOException {
   flush();
   super.flushBuffer();
 }
Example #6
0
 @Override
 public void flushBuffer() throws IOException {
   if (!isError()) {
     super.flushBuffer();
   }
 }