Class HttpSender

java.lang.Object
org.eclipse.jetty.client.HttpSender
All Implemented Interfaces:
EventListener, AsyncContentProvider.Listener
Direct Known Subclasses:
HttpSenderOverHTTP

public abstract class HttpSender extends Object implements AsyncContentProvider.Listener
HttpSender abstracts the algorithm to send HTTP requests, so that subclasses only implement the transport-specific code to send requests over the wire, implementing sendHeaders(HttpExchange, HttpContent, Callback) and sendContent(HttpExchange, HttpContent, Callback).

HttpSender governs two state machines.

The request state machine is updated by HttpSender as the various steps of sending a request are executed, see RequestState. At any point in time, a user thread may abort the request, which may (if the request has not been completely sent yet) move the request state machine to RequestState#FAILURE. The request state machine guarantees that the request steps are executed (by I/O threads) only if the request has not been failed already.

The sender state machine is updated by HttpSender from three sources: deferred content notifications (via onContent()), 100-continue notifications (via proceed(HttpExchange, Throwable)) and normal request send (via sendContent(HttpExchange, HttpContent, Callback)). This state machine must guarantee that the request sending is never executed concurrently: only one of those sources may trigger the call to sendContent(HttpExchange, HttpContent, Callback).

See Also: