public interface HttpConnection extends HttpRequester, GracefulAutoCloseable
Modifier and Type | Method and Description |
---|---|
default BlockingHttpConnection |
asBlockingConnection()
Convert this
HttpConnection to the BlockingHttpConnection API. |
default BlockingStreamingHttpConnection |
asBlockingStreamingConnection()
Convert this
HttpConnection to the BlockingStreamingHttpConnection API. |
StreamingHttpConnection |
asStreamingConnection()
Convert this
HttpConnection to the StreamingHttpConnection API. |
default void |
close() |
default void |
closeGracefully()
Used to close/shutdown a resource, similar to
AutoCloseable.close() , but attempts to cleanup state before
abruptly closing. |
HttpConnectionContext |
connectionContext()
Get the
HttpConnectionContext . |
Single<HttpResponse> |
request(HttpRequest request)
Send a
request . |
<T> Publisher<? extends T> |
transportEventStream(HttpEventKey<T> eventKey)
Returns a
Publisher that gives the current value of a transport event as well as subsequent changes to
the event value as long as the PublisherSource.Subscriber has expressed enough demand. |
executionContext, httpResponseFactory, request
connect, delete, get, head, newRequest, options, patch, post, put, trace
onClose
closeAsync, closeAsyncGracefully
Single<HttpResponse> request(HttpRequest request)
request
.request
- the request to send.HttpConnectionContext connectionContext()
HttpConnectionContext
.HttpConnectionContext
.<T> Publisher<? extends T> transportEventStream(HttpEventKey<T> eventKey)
Publisher
that gives the current value of a transport event as well as subsequent changes to
the event value as long as the PublisherSource.Subscriber
has expressed enough demand.
This is designed for events produced by the transport, and consumed by filters interested in transport behavior which is not directly involved in the data path.
T
- Type of the event value.eventKey
- Name of the event to fetch.Publisher
for the event values.StreamingHttpConnection asStreamingConnection()
HttpConnection
to the StreamingHttpConnection
API.StreamingHttpConnection
representation of this HttpConnection
.default BlockingStreamingHttpConnection asBlockingStreamingConnection()
HttpConnection
to the BlockingStreamingHttpConnection
API.BlockingStreamingHttpConnection
representation of this HttpConnection
.default BlockingHttpConnection asBlockingConnection()
HttpConnection
to the BlockingHttpConnection
API.BlockingHttpConnection
representation of this HttpConnection
.default void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception
default void closeGracefully() throws java.lang.Exception
GracefulAutoCloseable
AutoCloseable.close()
, but attempts to cleanup state before
abruptly closing. This provides a hint that implementations can use to stop accepting new work and finish in
flight work. This method is implemented on a "best effort" basis and may be equivalent to AutoCloseable.close()
.
Note: Implementations may or may not apply a timeout for this operation to complete, if a caller does not
want to wait indefinitely, and are unsure if the implementation applies a timeout, it is advisable to apply a
timeout and force a call to AutoCloseable.close()
.
closeGracefully
in interface GracefulAutoCloseable
java.lang.Exception
- if graceful closure failed.