Class HttpReceiver

    • Field Detail

      • LOG

        protected static final Logger LOG
    • Constructor Detail

      • HttpReceiver

        protected HttpReceiver​(HttpChannel channel)
    • Method Detail

      • getHttpChannel

        protected HttpChannel getHttpChannel()
      • demand

        protected long demand()
      • hasDemandOrStall

        protected boolean hasDemandOrStall()
      • getHttpExchange

        protected HttpExchange getHttpExchange()
      • isFailed

        public boolean isFailed()
      • receive

        protected void receive()
      • responseBegin

        protected boolean responseBegin​(HttpExchange exchange)
        Method to be invoked when the response status code is available.

        Subclasses must have set the response status code on the Response object of the HttpExchange prior invoking this method.

        This method takes case of notifying Response.BeginListeners.

        Parameters:
        exchange - the HTTP exchange
        Returns:
        whether the processing should continue
      • responseHeader

        protected boolean responseHeader​(HttpExchange exchange,
                                         HttpField field)
        Method to be invoked when a response HTTP header is available.

        Subclasses must not have added the header to the Response object of the HttpExchange prior invoking this method.

        This method takes case of notifying Response.HeaderListeners and storing cookies.

        Parameters:
        exchange - the HTTP exchange
        field - the response HTTP field
        Returns:
        whether the processing should continue
      • storeCookie

        protected void storeCookie​(java.net.URI uri,
                                   HttpField field)
      • responseHeaders

        protected boolean responseHeaders​(HttpExchange exchange)
        Method to be invoked after all response HTTP headers are available.

        This method takes case of notifying Response.HeadersListeners.

        Parameters:
        exchange - the HTTP exchange
        Returns:
        whether the processing should continue
      • responseContent

        protected boolean responseContent​(HttpExchange exchange,
                                          java.nio.ByteBuffer buffer,
                                          Callback callback)
        Method to be invoked when response HTTP content is available.

        This method takes case of decoding the content, if necessary, and notifying Response.ContentListeners.

        Parameters:
        exchange - the HTTP exchange
        buffer - the response HTTP content buffer
        callback - the callback
        Returns:
        whether the processing should continue
      • responseSuccess

        protected boolean responseSuccess​(HttpExchange exchange)
        Method to be invoked when the response is successful.

        This method takes case of notifying Response.SuccessListeners and possibly Response.CompleteListeners (if the exchange is completed).

        Parameters:
        exchange - the HTTP exchange
        Returns:
        whether the response was processed as successful
      • responseFailure

        protected boolean responseFailure​(java.lang.Throwable failure)
        Method to be invoked when the response is failed.

        This method takes care of notifying Response.FailureListeners.

        Parameters:
        failure - the response failure
        Returns:
        whether the response was processed as failed
      • reset

        protected void reset()
        Resets the state of this HttpReceiver.

        Subclasses should override (but remember to call super) to reset their own state.

        Either this method or dispose() is called.

      • dispose

        protected void dispose()
        Disposes the state of this HttpReceiver.

        Subclasses should override (but remember to call super) to dispose their own state.

        Either this method or reset() is called.

      • abort

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

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