Class HttpSender

    • Field Detail

      • LOG

        protected static final Logger LOG
    • Constructor Detail

      • HttpSender

        protected HttpSender​(HttpChannel channel)
    • Method Detail

      • getHttpChannel

        protected HttpChannel getHttpChannel()
      • getHttpExchange

        protected HttpExchange getHttpExchange()
      • isFailed

        public boolean isFailed()
      • expects100Continue

        protected boolean expects100Continue​(Request request)
      • queuedToBegin

        protected boolean queuedToBegin​(HttpExchange exchange)
      • beginToHeaders

        protected boolean beginToHeaders​(HttpExchange exchange)
      • headersToCommit

        protected boolean headersToCommit​(HttpExchange exchange)
      • someToContent

        protected boolean someToContent​(HttpExchange exchange,
                                        java.nio.ByteBuffer content)
      • someToSuccess

        protected boolean someToSuccess​(HttpExchange exchange)
      • sendHeaders

        protected abstract void sendHeaders​(HttpExchange exchange,
                                            HttpContent content,
                                            Callback callback)
        Implementations should send the HTTP headers over the wire, possibly with some content, in a single write, and notify the given callback of the result of this operation.

        If there is more content to send, then sendContent(HttpExchange, HttpContent, Callback) will be invoked.

        Parameters:
        exchange - the exchange to send
        content - the content to send
        callback - the callback to notify
      • sendContent

        protected abstract void sendContent​(HttpExchange exchange,
                                            HttpContent content,
                                            Callback callback)
        Implementations should send the content at the HttpContent cursor position over the wire.

        The HttpContent cursor is advanced by HttpSender at the right time, and if more content needs to be sent, this method is invoked again; subclasses need only to send the content at the HttpContent cursor position.

        This method is invoked one last time when HttpContent.isConsumed() is true and therefore there is no actual content to send. This is done to allow subclasses to write "terminal" bytes (such as the terminal chunk when the transfer encoding is chunked) if their protocol needs to.

        Parameters:
        exchange - the exchange to send
        content - the content to send
        callback - the callback to notify
      • reset

        protected void reset()
      • dispose

        protected void dispose()
      • proceed

        public void proceed​(HttpExchange exchange,
                            java.lang.Throwable failure)
      • abort

        public boolean abort​(HttpExchange exchange,
                             java.lang.Throwable failure)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object