Class HttpOutput

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, Runnable

@Deprecated(since="2021-05-27") public class HttpOutput extends ServletOutputStream implements Runnable
Deprecated.
The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.

HttpOutput implements ServletOutputStream as required by the Servlet specification.

HttpOutput buffers content written by the application until a further write will overflow the buffer, at which point it triggers a commit of the response.

HttpOutput can be closed and reopened, to allow requests included via RequestDispatcher.include(ServletRequest, ServletResponse) to close the stream, to be reopened after the inclusion ends.

  • Constructor Details

    • HttpOutput

      public HttpOutput(HttpChannel channel)
      Deprecated.
  • Method Details

    • getHttpChannel

      public HttpChannel getHttpChannel()
      Deprecated.
    • getInterceptor

      public HttpOutput.Interceptor getInterceptor()
      Deprecated.
    • setInterceptor

      public void setInterceptor(HttpOutput.Interceptor interceptor)
      Deprecated.
    • isWritten

      public boolean isWritten()
      Deprecated.
    • getWritten

      public long getWritten()
      Deprecated.
    • reopen

      public void reopen()
      Deprecated.
    • softClose

      public void softClose()
      Deprecated.
    • complete

      public void complete(Callback callback)
      Deprecated.
    • completed

      public void completed(Throwable failure)
      Deprecated.
      Called to indicate that the request cycle has been completed.
    • close

      public void close() throws IOException
      Deprecated.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException
    • getBuffer

      public ByteBuffer getBuffer()
      Deprecated.
    • isClosed

      public boolean isClosed()
      Deprecated.
    • isAsync

      public boolean isAsync()
      Deprecated.
    • flush

      public void flush() throws IOException
      Deprecated.
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
      Throws:
      IOException
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Deprecated.
      Overrides:
      write in class OutputStream
      Throws:
      IOException
    • write

      public void write(ByteBuffer buffer) throws IOException
      Deprecated.
      Throws:
      IOException
    • write

      public void write(int b) throws IOException
      Deprecated.
      Specified by:
      write in class OutputStream
      Throws:
      IOException
    • print

      public void print(String s) throws IOException
      Deprecated.
      Description copied from class: ServletOutputStream
      Writes a String to the client, without a carriage return-line feed (CRLF) character at the end.
      Overrides:
      print in class ServletOutputStream
      Parameters:
      s - the String to send to the client
      Throws:
      IOException - if an input or output exception occurred
    • println

      public void println(String s) throws IOException
      Deprecated.
      Description copied from class: ServletOutputStream
      Writes a String to the client, followed by a carriage return-line feed (CRLF).
      Overrides:
      println in class ServletOutputStream
      Parameters:
      s - the String to write to the client
      Throws:
      IOException - if an input or output exception occurred
    • println

      public void println(boolean b) throws IOException
      Deprecated.
      Description copied from class: ServletOutputStream
      Writes a boolean value to the client, followed by a carriage return-line feed (CRLF).
      Overrides:
      println in class ServletOutputStream
      Parameters:
      b - the boolean value to write to the client
      Throws:
      IOException - if an input or output exception occurred
    • println

      public void println(char c) throws IOException
      Deprecated.
      Description copied from class: ServletOutputStream
      Writes a character to the client, followed by a carriage return-line feed (CRLF).
      Overrides:
      println in class ServletOutputStream
      Parameters:
      c - the character to write to the client
      Throws:
      IOException - if an input or output exception occurred
    • println

      public void println(int i) throws IOException
      Deprecated.
      Description copied from class: ServletOutputStream
      Writes an int to the client, followed by a carriage return-line feed (CRLF) character.
      Overrides:
      println in class ServletOutputStream
      Parameters:
      i - the int to write to the client
      Throws:
      IOException - if an input or output exception occurred
    • println

      public void println(long l) throws IOException
      Deprecated.
      Description copied from class: ServletOutputStream
      Writes a long value to the client, followed by a carriage return-line feed (CRLF).
      Overrides:
      println in class ServletOutputStream
      Parameters:
      l - the long value to write to the client
      Throws:
      IOException - if an input or output exception occurred
    • println

      public void println(float f) throws IOException
      Deprecated.
      Description copied from class: ServletOutputStream
      Writes a float value to the client, followed by a carriage return-line feed (CRLF).
      Overrides:
      println in class ServletOutputStream
      Parameters:
      f - the float value to write to the client
      Throws:
      IOException - if an input or output exception occurred
    • println

      public void println(double d) throws IOException
      Deprecated.
      Description copied from class: ServletOutputStream
      Writes a double value to the client, followed by a carriage return-line feed (CRLF).
      Overrides:
      println in class ServletOutputStream
      Parameters:
      d - the double value to write to the client
      Throws:
      IOException - if an input or output exception occurred
    • sendContent

      public void sendContent(ByteBuffer content) throws IOException
      Deprecated.
      Blocking send of whole content.
      Parameters:
      content - The whole content to send
      Throws:
      IOException - if the send fails
    • sendContent

      public void sendContent(InputStream in) throws IOException
      Deprecated.
      Blocking send of stream content.
      Parameters:
      in - The stream content to send
      Throws:
      IOException - if the send fails
    • sendContent

      public void sendContent(ReadableByteChannel in) throws IOException
      Deprecated.
      Blocking send of channel content.
      Parameters:
      in - The channel content to send
      Throws:
      IOException - if the send fails
    • sendContent

      public void sendContent(HttpContent content) throws IOException
      Deprecated.
      Blocking send of HTTP content.
      Parameters:
      content - The HTTP content to send
      Throws:
      IOException - if the send fails
    • sendContent

      public void sendContent(ByteBuffer content, Callback callback)
      Deprecated.
      Asynchronous send of whole content.
      Parameters:
      content - The whole content to send
      callback - The callback to use to notify success or failure
    • sendContent

      public void sendContent(InputStream in, Callback callback)
      Deprecated.
      Asynchronous send of stream content. The stream will be closed after reading all content.
      Parameters:
      in - The stream content to send
      callback - The callback to use to notify success or failure
    • sendContent

      public void sendContent(ReadableByteChannel in, Callback callback)
      Deprecated.
      Asynchronous send of channel content. The channel will be closed after reading all content.
      Parameters:
      in - The channel content to send
      callback - The callback to use to notify success or failure
    • sendContent

      public void sendContent(HttpContent httpContent, Callback callback)
      Deprecated.
      Asynchronous send of HTTP content.
      Parameters:
      httpContent - The HTTP content to send
      callback - The callback to use to notify success or failure
    • getBufferSize

      public int getBufferSize()
      Deprecated.
    • setBufferSize

      public void setBufferSize(int size)
      Deprecated.
    • onFlushed

      public void onFlushed(long bytes) throws IOException
      Deprecated.

      Invoked when bytes have been flushed to the network.

      The number of flushed bytes may be different from the bytes written by the application if an HttpOutput.Interceptor changed them, for example by compressing them.

      Parameters:
      bytes - the number of bytes flushed
      Throws:
      IOException - if the minimum data rate, when set, is not respected
      See Also:
    • recycle

      public void recycle()
      Deprecated.
    • resetBuffer

      public void resetBuffer()
      Deprecated.
    • setWriteListener

      public void setWriteListener(WriteListener writeListener)
      Deprecated.
      Description copied from class: ServletOutputStream
      Sets the WriteListener for this ServletOutputStream and thereby switches to non-blocking IO. It is only valid to switch to non-blocking IO within async processing or HTTP upgrade processing.
      Specified by:
      setWriteListener in class ServletOutputStream
      Parameters:
      writeListener - The non-blocking IO write listener
    • isReady

      public boolean isReady()
      Deprecated.
      Description copied from class: ServletOutputStream
      Checks if a non-blocking write will succeed. If this returns false, it will cause a callback to WriteListener.onWritePossible() when the buffer has emptied. If this method returns false no further data must be written until the contain calls WriteListener.onWritePossible().
      Specified by:
      isReady in class ServletOutputStream
      Returns:
      true if data can be written, else false
    • run

      public void run()
      Deprecated.
      Specified by:
      run in interface Runnable
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object