/* ------------------------------------------------------------ */ public ServletOutputStream getOutputStream() { if (_outputState == DISABLED) return __nullServletOut; if (_outputState != NO_OUT && _outputState != OUTPUTSTREAM_OUT) throw new IllegalStateException(); if (_writer != null) { _writer.flush(); _writer.disable(); _writer = null; } if (_out == null) _out = new ServletOut(_servletHttpRequest.getHttpRequest().getOutputStream()); _outputState = OUTPUTSTREAM_OUT; return _out; }
/* ------------------------------------------------------------ */ public void flushBuffer() throws IOException { if (((HttpOutputStream) _httpResponse.getOutputStream()).isClosed()) return; if (_writer != null) _writer.flush(); if (_out != null) _out.flush(); if (_writer == null && _out == null) _httpResponse.getOutputStream().flush(); if (!_httpResponse.isCommitted()) _httpResponse.commit(); }
/* ------------------------------------------------------------ */ void setOutputState(int s) throws IOException { if (s < 0) { _outputState = DISABLED; if (_writer != null) _writer.disable(); _writer = null; if (_out != null) _out.disable(); _out = null; } else _outputState = s; }
/* ------------------------------------------------------------ */ public void resetBuffer() { if (isCommitted()) throw new IllegalStateException("Committed"); ((HttpOutputStream) _httpResponse.getOutputStream()).resetBuffer(); if (_writer != null) _writer.reset(); }
/* ------------------------------------------------------------ */ public void setBufferSize(int size) { HttpOutputStream out = (HttpOutputStream) _httpResponse.getOutputStream(); if (out.isWritten() || _writer != null && _writer.isWritten()) throw new IllegalStateException("Output written"); out.setBufferSize(size); }
/* ------------------------------------------------------------ */ void commit() throws IOException { if (_writer != null && _writer.isWritten()) _writer.flush(); else _httpResponse.commit(); }