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).
HttpReceiver| Modifier and Type | Method and Description |
|---|---|
boolean |
abort(HttpExchange exchange,
Throwable failure) |
boolean |
isFailed() |
void |
onContent()
Callback method invoked when content is available
|
void |
proceed(HttpExchange exchange,
Throwable failure) |
void |
send(HttpExchange exchange) |
String |
toString() |
public boolean isFailed()
public void onContent()
AsyncContentProvider.ListeneronContent in interface AsyncContentProvider.Listenerpublic void send(HttpExchange exchange)
public void proceed(HttpExchange exchange, Throwable failure)
public boolean abort(HttpExchange exchange, Throwable failure)
Copyright © 2010 - 2020 Adobe. All Rights Reserved