Class HttpExchangeBase

java.lang.Object
io.undertow.httpcore.HttpExchangeBase
All Implemented Interfaces:
HttpExchange, OutputChannel, Closeable, AutoCloseable

public abstract class HttpExchangeBase extends Object implements HttpExchange, OutputChannel
  • Field Details

  • Constructor Details

    • HttpExchangeBase

      public HttpExchangeBase()
  • Method Details

    • setCompletedListener

      public void setCompletedListener(CompletedListener listener)
      Specified by:
      setCompletedListener in interface HttpExchange
    • setPreCommitListener

      public void setPreCommitListener(PreCommitListener listener)
      Specified by:
      setPreCommitListener in interface HttpExchange
    • terminateRequest

      protected void terminateRequest()
      Force the codec to treat the request as fully read. Should only be invoked by handlers which downgrade the socket or implement a transfer coding.
    • terminateResponse

      protected void terminateResponse()
      Force the codec to treat the response as fully written. Should only be invoked by handlers which downgrade the socket or implement a transfer coding.
    • setBlockingHttpExchange

      public void setBlockingHttpExchange(BlockingHttpExchange exchange)
      Specified by:
      setBlockingHttpExchange in interface HttpExchange
    • getOutputStream

      public OutputStream getOutputStream()
      Specified by:
      getOutputStream in interface HttpExchange
    • getInputStream

      public InputStream getInputStream()
      Specified by:
      getInputStream in interface HttpExchange
    • isComplete

      public boolean isComplete()
      Returns true if the completion handler for this exchange has been invoked, and the request is considered finished.
      Specified by:
      isComplete in interface HttpExchange
    • isRequestComplete

      public boolean isRequestComplete()
      Returns true if all data has been read from the request, or if there was not data.
      Specified by:
      isRequestComplete in interface HttpExchange
      Returns:
      true if the request is complete
    • isResponseComplete

      public boolean isResponseComplete()
      Specified by:
      isResponseComplete in interface HttpExchange
      Returns:
      true if the responses is complete
    • endExchange

      public void endExchange()
      Specified by:
      endExchange in interface HttpExchange
    • writeAsync

      public final void writeAsync(String data)
      Description copied from interface: OutputChannel
      Writes the given UTF-8 data and ends the exchange
      Specified by:
      writeAsync in interface OutputChannel
      Parameters:
      data - The data to write
    • writeAsync

      public final void writeAsync(String data, Charset charset)
      Description copied from interface: OutputChannel
      Writes the given data in the provided charset and ends the exchange
      Specified by:
      writeAsync in interface OutputChannel
      Parameters:
      data - The data to write
    • writeAsync

      public final <T> void writeAsync(String data, Charset charset, boolean last, IoCallback<T> callback, T context)
      Description copied from interface: OutputChannel
      Writes the given data in the provided charset and invokes the provided callback on completion
      Specified by:
      writeAsync in interface OutputChannel
      Parameters:
      data - The data to write
    • addWriteFunction

      public void addWriteFunction(WriteFunction listener)
      Specified by:
      addWriteFunction in interface HttpExchange
    • getOutputChannel

      public OutputChannel getOutputChannel()
      Specified by:
      getOutputChannel in interface HttpExchange
    • isResponseStarted

      protected boolean isResponseStarted()
    • writeAsync

      public final <T> void writeAsync(io.netty.buffer.ByteBuf data, boolean last, IoCallback<T> callback, T context)
      Specified by:
      writeAsync in interface OutputChannel
    • writeAsync0

      protected abstract <T> void writeAsync0(io.netty.buffer.ByteBuf data, boolean last, IoCallback<T> callback, T context)
    • writeBlocking

      public final void writeBlocking(io.netty.buffer.ByteBuf data, boolean last) throws IOException
      Specified by:
      writeBlocking in interface OutputChannel
      Throws:
      IOException
    • writeBlocking0

      protected abstract void writeBlocking0(io.netty.buffer.ByteBuf data, boolean last) throws IOException
      Throws:
      IOException
    • getResponseBytesSent

      public long getResponseBytesSent()
      Specified by:
      getResponseBytesSent in interface HttpExchange
      Returns:
      The number of bytes sent in the entity body
    • isResponseEntityBodyAllowed

      protected boolean isResponseEntityBodyAllowed()
    • isRequestEntityBodyAllowed

      protected boolean isRequestEntityBodyAllowed()