Interface HttpTransportObserver.ConnectionObservation
- Enclosing interface:
HttpTransportObserver
The publisher must invoke all lifecycle methods for this connection sequentially. This includes methods on
this observation and on any HttpTransportObserver.HandshakeObservation or HttpTransportObserver.StreamObservation it returns. Concurrent
lifecycle calls for the same connection are unsupported. Events for different connections may be published
concurrently.
-
Method Summary
Modifier and TypeMethodDescriptionvoidCompletes this connection observation.Observes the start of the configured handshake.noop()Returns a no-op connection observation.voidprotocolSelected(String protocol) Reports the currently selected HTTP protocol.streamOpened(HttpTransportObserver.Direction direction, HttpTransportObserver.Initiator initiator) Observes a started application request and response exchange.
-
Method Details
-
noop
Returns a no-op connection observation.- Returns:
- no-op observation
-
handshakeStarted
HttpTransportObserver.HandshakeObservation handshakeStarted()Observes the start of the configured handshake.The same observation is returned if this method is invoked more than once. The returned observation must not be
null. Implementations that do not observe handshakes should returnHttpTransportObserver.HandshakeObservation.noop().- Returns:
- handshake observation
-
protocolSelected
Reports the currently selected HTTP protocol.Publishers must report a known HTTP version using the corresponding
PROTOCOL_HTTP_*constant, rather than its negotiation identifier. For example,h2andh2cmap toHttpTransportObserver.PROTOCOL_HTTP_2, andh3maps toHttpTransportObserver.PROTOCOL_HTTP_3. A protocol for which this observer defines no constant may use its own stable, non-blank identifier.The first selection marks the physical connection as established and usable for that protocol. A publisher must therefore report the first selection only after any required transport security handshake has succeeded and its
HttpTransportObserver.HandshakeObservation.close(HandshakeOutcome)call has returned. The selected protocol may later change, for example after a successful HTTP/1.1 upgrade to HTTP/2. Repeated selection of an equal protocol identifier has no effect.- Parameters:
protocol- non-blank selected protocol identifier, normalized to a known constant when applicable
-
streamOpened
HttpTransportObserver.StreamObservation streamOpened(HttpTransportObserver.Direction direction, HttpTransportObserver.Initiator initiator) Observes a started application request and response exchange.An HTTP/1.1 publisher reports each exchange once as a
HttpTransportObserver.Direction.BIDIRECTIONALstream, withHttpTransportObserver.Initiatoridentifying the request sender relative to the observed endpoint. HTTP/2 and HTTP/3 publishers apply the same mapping to request streams. Publishers must not report server-push streams, protocol control streams, compression-state streams such as HTTP/3 QPACK encoder or decoder streams, or underlying transport streams.The publisher must report the initial protocol selection before invoking this method. For a secured transport, this means after the required security handshake has succeeded. This lifecycle model does not represent HTTP streams accepted as TLS or QUIC early data.
The caller owns the returned observation and closes it when the stream terminates. The returned observation must not be
null.- Parameters:
direction- stream directionalityinitiator- stream initiator- Returns:
- stream observation
-
close
Completes this connection observation.This method is idempotent. It also completes any handshake or stream observations which are still open. Open child observations receive these outcomes:
- Parameters:
outcome- termination outcome
-