Class HttpReceiver

  • Direct Known Subclasses:
    HttpReceiverOverHTTP

    @Deprecated(since="2021-05-27")
    public abstract class HttpReceiver
    extends java.lang.Object
    Deprecated.
    The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
    HttpReceiver provides the abstract code to implement the various steps of the receive of HTTP responses.

    HttpReceiver maintains a state machine that is updated when the steps of receiving a response are executed.

    Subclasses must handle the transport-specific details, for example how to read from the raw socket and how to parse the bytes read from the socket. Then they have to call the methods defined in this class in the following order:

    1. responseBegin(HttpExchange), when the HTTP response data containing the HTTP status code is available
    2. responseHeader(HttpExchange, HttpField), when an HTTP field is available
    3. responseHeaders(HttpExchange), when all HTTP headers are available
    4. responseContent(HttpExchange, ByteBuffer, Callback), when HTTP content is available
    5. responseSuccess(HttpExchange), when the response is successful
    At any time, subclasses may invoke responseFailure(Throwable) to indicate that the response has failed (for example, because of I/O exceptions). At any time, user threads may abort the response which will cause responseFailure(Throwable) to be invoked.

    The state machine maintained by this class ensures that the response steps are not executed by an I/O thread if the response has already been failed.

    See Also:
    HttpSender
    • Method Detail

      • isFailed

        public boolean isFailed()
        Deprecated.
      • abort

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

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