APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.net.http

pack-priv abstract Class HttpQuicConnection

extends HttpConnection
Class Inheritance
Known Direct Subclasses
jdk.internal.net.http.HttpQuicConnection.H3QuicConnectionImpl
Imports
java.io.IOException, java.net.ConnectException, .InetSocketAddress, .SocketAddress, .SocketOption, .URI, java.net.http.HttpConnectTimeoutException, java.nio.channels.NetworkChannel, java.time.Duration, java.util.List, .Objects, .Optional, .Set, java.util.concurrent.CompletableFuture, .TimeUnit, java.util.function.Function, javax.net.ssl.SNIServerName, .SSLParameters, jdk.internal.net.http.ConnectionPool.CacheKey, .AltServicesRegistry.AltService, jdk.internal.net.http.common.FlowTube, .Log, .Logger, .MinimalFuture, .Utils, jdk.internal.net.http.quic.ConnectionTerminator, .TerminationCause, .QuicConnection

An HttpQuicConnection models an HTTP connection over QUIC. The particulars of the HTTP/3 protocol are handled by the Http3Connection class.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
HttpQuicConnection.DirectConnectionUpdater

A functional interface used to update the Alternate Service Registry after a direct connection attempt.

pack-priv static class

Field Summary

Modifier and TypeField and Description
private volatile boolean
pack-priv final Logger
pack-priv final QuicConnection
pack-priv final ConnectionTerminator
private final AltServicesRegistry.AltService
Inherited from jdk.internal.net.http.HttpConnection:
addressCOMPARE_BY_IDdbgTagDEBUG_LOGGER

Constructor Summary

AccessConstructor and Description
pack-priv
HttpQuicConnection(Origin originServer, InetSocketAddress address, HttpClientImpl client, QuicConnection quicConnection, AltServicesRegistry.AltService sourceAltService)

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract ConnectionPool.CacheKey
pack-priv abstract NetworkChannel
pack-priv final void
close(final long
the connection close code
connCloseCode
,
final String
the message to be included in the logs as the cause of the connection termination. can be null.
logMsg
,
final Throwable
the underlying cause of the connection termination. can be null, in which case just the error will be recorded as the cause of the connection termination.
closeCause
)

Closes the underlying transport connection with the given connCloseCode code.

pack-priv abstract void
close(final Throwable t)

Implements abstract jdk.internal.net.http.HttpConnection.close.

Closes this connection due to the given cause.

public abstract CompletableFuture<Void>
connectAsync(Exchange<?> exchange)

Implements abstract jdk.internal.net.http.HttpConnection.connectAsync.

Initiates the connect phase.

pack-priv boolean
connected()

Implements abstract jdk.internal.net.http.HttpConnection.connected.

Tells whether, or not, this connection is connected to its destination.

public abstract void
connectionEstablished(Http3Connection
the HTTP/3 connection, if successful, or null, otherwise
connection
,
Throwable
the exception encountered, if unsuccessful
throwable
)

Called when the HTTP/3 connection is established, either successfully or unsuccessfully

public CompletableFuture<Void>
finishConnect()

Implements abstract jdk.internal.net.http.HttpConnection.finishConnect.

Finishes the connection phase.

pack-priv final FlowTube

Returns:

nothing: this method always throw IllegalStateException
getConnectionFlow
()

Implements abstract jdk.internal.net.http.HttpConnection.getConnectionFlow.

Returns the underlying connection flow, if applicable.

public static HttpQuicConnection

Returns:

A new HttpQuicConnection or null
getHttpQuicConnection
(final InetSocketAddress
the HTTP/3 peer endpoint address, if direct connection
addr
,
final InetSocketAddress
the proxy address, if a proxy is used, in which case this method will return null as proxying is not supported with HTTP/3
proxy
,
final HttpRequestImpl
the request for which the connection is being created
request
,
final Exchange<?>
the exchange for which the connection is being created
exchange
,
final HttpClientImpl
the HttpClientImpl instance
client
)

This method create and return a new unconnected HttpQuicConnection, wrapping a QuicConnection.

public List<SNIServerName>
getSNIServerNames()

Overrides jdk.internal.net.http.HttpConnection.getSNIServerNames.

Returns an unmodifiable list of SNIServerNames that were used during TLS handshake of this connection.

pack-priv Optional<AltServicesRegistry.AltService>

Returns:

The source alt-service if present
getSourceAltService
()

A HTTP QUIC connection could be created due to an alt-service that was advertised from some origin.

pack-priv boolean

Returns:

true if the underlying Quic connection has been terminated.
isFlowFinished
()

Overrides jdk.internal.net.http.HttpConnection.isFlowFinished.

Unlike HTTP/1.1 and HTTP/2, an HTTP/3 connection is not built on a single connection flow, since multiplexing is provided by the lower layer.

pack-priv final boolean
isProxied()

Implements abstract jdk.internal.net.http.HttpConnection.isProxied.

Tells whether, or not, this connection is proxied.

pack-priv final boolean
isSecure()

Implements abstract jdk.internal.net.http.HttpConnection.isSecure.

Tells whether, or not, this connection is secure ( over SSL )

pack-priv boolean
private static void
pack-priv final InetSocketAddress
proxy()

Implements abstract jdk.internal.net.http.HttpConnection.proxy.

Returns the address of the proxy used by this connection.

pack-priv final HttpConnection.HttpPublisher
pack-priv QuicConnection
pack-priv final String
pack-priv static void
registerUnadvertised(final HttpClientImpl client, final URI requestURI, final InetSocketAddress destAddr, final Http3Connection connection, final Throwable t)

public String
toString()

Overrides jdk.internal.net.http.HttpConnection.toString.

Returns a string representation of the object.

Inherited from jdk.internal.net.http.HttpConnection:
addressaddTrailingOperationcheckOpenclientclosecloseOrReturnToCachecontextRestricteddbgStringgetConnectiongetOriginServerheaderFilterisOpenlabelnewConnectionId

Field Detail

connectedback to summary
private volatile boolean connected
debugback to summary
pack-priv final Logger debug

Hides jdk.internal.net.http.HttpConnection.debug.

quicConnectionback to summary
pack-priv final QuicConnection quicConnection
quicConnTerminatorback to summary
pack-priv final ConnectionTerminator quicConnTerminator
sourceAltServiceback to summary
private final AltServicesRegistry.AltService sourceAltService

Constructor Detail

HttpQuicConnectionback to summary
pack-priv HttpQuicConnection(Origin originServer, InetSocketAddress address, HttpClientImpl client, QuicConnection quicConnection, AltServicesRegistry.AltService sourceAltService)

Method Detail

cacheKeyback to summary
pack-priv abstract ConnectionPool.CacheKey cacheKey()

Implements abstract jdk.internal.net.http.HttpConnection.cacheKey.

channelback to summary
pack-priv abstract NetworkChannel channel()

Implements abstract jdk.internal.net.http.HttpConnection.channel.

closeback to summary
pack-priv final void close(final long connCloseCode, final String logMsg, final Throwable closeCause)

Closes the underlying transport connection with the given connCloseCode code. This will be considered a application layer close and will generate a ConnectionCloseFrame of type 0x1d as the cause of the termination.

Parameters
connCloseCode:long

the connection close code

logMsg:String

the message to be included in the logs as the cause of the connection termination. can be null.

closeCause:Throwable

the underlying cause of the connection termination. can be null, in which case just the error will be recorded as the cause of the connection termination.

closeback to summary
pack-priv abstract void close(final Throwable t)

Implements abstract jdk.internal.net.http.HttpConnection.close.

Doc from jdk.internal.net.http.HttpConnection.close.

Closes this connection due to the given cause.

connectAsyncback to summary
public abstract CompletableFuture<Void> connectAsync(Exchange<?> exchange)

Implements abstract jdk.internal.net.http.HttpConnection.connectAsync.

Initiates the connect phase. Returns a CompletableFuture that completes when the underlying TCP connection has been established or an error occurs.

connectedback to summary
pack-priv boolean connected()

Implements abstract jdk.internal.net.http.HttpConnection.connected.

Tells whether, or not, this connection is connected to its destination.

connectionEstablishedback to summary
public abstract void connectionEstablished(Http3Connection connection, Throwable throwable)

Called when the HTTP/3 connection is established, either successfully or unsuccessfully

Parameters
connection:Http3Connection

the HTTP/3 connection, if successful, or null, otherwise

throwable:Throwable

the exception encountered, if unsuccessful

finishConnectback to summary
public CompletableFuture<Void> finishConnect()

Implements abstract jdk.internal.net.http.HttpConnection.finishConnect.

Finishes the connection phase. Returns a CompletableFuture that completes when any additional, type specific, setup has been done. Must be called after connectAsync.

getConnectionFlowback to summary
pack-priv final FlowTube getConnectionFlow()

Implements abstract jdk.internal.net.http.HttpConnection.getConnectionFlow.

Doc from jdk.internal.net.http.HttpConnection.getConnectionFlow.

Returns the underlying connection flow, if applicable.

Implementation Specification

Unlike HTTP/1.1 and HTTP/2, an HTTP/3 connection is not built on a single connection flow, since multiplexing is provided by the lower layer. Therefore, the higher HTTP layer should never call getConnectionFlow() on an HttpQuicConnection. As a consequence, this method always throws IllegalStateException unconditionally.

Returns:FlowTube

nothing: this method always throw IllegalStateException

Annotations
@Override
Exceptions
IllegalStateException:
always
getHttpQuicConnectionback to summary
public static HttpQuicConnection getHttpQuicConnection(final InetSocketAddress addr, final InetSocketAddress proxy, final HttpRequestImpl request, final Exchange<?> exchange, final HttpClientImpl client)

This method create and return a new unconnected HttpQuicConnection, wrapping a QuicConnection. May return null if HTTP/3 is not supported with the given parameters. For instance, if TLSv1.3 isn't available/enabled in the client's SSLParameters, or if ALT_SERVICE is required but no alt service is found.

Parameters
addr:InetSocketAddress

the HTTP/3 peer endpoint address, if direct connection

proxy:InetSocketAddress

the proxy address, if a proxy is used, in which case this method will return null as proxying is not supported with HTTP/3

request:HttpRequestImpl

the request for which the connection is being created

exchange:Exchange<?>

the exchange for which the connection is being created

client:HttpClientImpl

the HttpClientImpl instance

Returns:HttpQuicConnection

A new HttpQuicConnection or null

getSNIServerNamesback to summary
public List<SNIServerName> getSNIServerNames()

Overrides jdk.internal.net.http.HttpConnection.getSNIServerNames.

Doc from jdk.internal.net.http.HttpConnection.getSNIServerNames.

Returns an unmodifiable list of SNIServerNames that were used during TLS handshake of this connection. If this connection doesn't represent a TLS based connection or if no SNI server names were used during the handshake, then this method returns an empty list.

Annotations
@Override
getSourceAltServiceback to summary
pack-priv Optional<AltServicesRegistry.AltService> getSourceAltService()

A HTTP QUIC connection could be created due to an alt-service that was advertised from some origin. This method returns that source alt-service if there was one.

Returns:Optional<AltServicesRegistry.AltService>

The source alt-service if present

isFlowFinishedback to summary
pack-priv boolean isFlowFinished()

Overrides jdk.internal.net.http.HttpConnection.isFlowFinished.

Unlike HTTP/1.1 and HTTP/2, an HTTP/3 connection is not built on a single connection flow, since multiplexing is provided by the lower layer. This method instead will return true if the underlying quic connection has been terminated, either exceptionally or normally.

Returns:boolean

true if the underlying Quic connection has been terminated.

Annotations
@Override
isProxiedback to summary
pack-priv final boolean isProxied()

Implements abstract jdk.internal.net.http.HttpConnection.isProxied.

Tells whether, or not, this connection is proxied. Returns true for tunnel connections, or clear connection to any host through proxy.

isSecureback to summary
pack-priv final boolean isSecure()

Implements abstract jdk.internal.net.http.HttpConnection.isSecure.

Tells whether, or not, this connection is secure ( over SSL )

isTunnelback to summary
pack-priv boolean isTunnel()

Overrides jdk.internal.net.http.HttpConnection.isTunnel.

logAltSvcForback to summary
private static void logAltSvcFor(Logger debug, URI uri, AltServicesRegistry.AltService altSvc, String where)
proxyback to summary
pack-priv final InetSocketAddress proxy()

Implements abstract jdk.internal.net.http.HttpConnection.proxy.

Returns the address of the proxy used by this connection. Returns the proxy address for tunnel connections, or clear connection to any host through proxy. Returns null otherwise.

publisherback to summary
pack-priv final HttpConnection.HttpPublisher publisher()

Implements abstract jdk.internal.net.http.HttpConnection.publisher.

This method throws an UnsupportedOperationException

Annotations
@Override
quicConnectionback to summary
pack-priv QuicConnection quicConnection()
quicDbgStringback to summary
pack-priv final String quicDbgString()
registerUnadvertisedback to summary
pack-priv static void registerUnadvertised(final HttpClientImpl client, final URI requestURI, final InetSocketAddress destAddr, final Http3Connection connection, final Throwable t)
toStringback to summary
public String toString()

Overrides jdk.internal.net.http.HttpConnection.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
jdk.internal.net.http back to summary

private Interface HttpQuicConnection.DirectConnectionUpdater

Annotations
@FunctionalInterface

A functional interface used to update the Alternate Service Registry after a direct connection attempt.

Method Summary

Modifier and TypeMethod and Description
public static void
noUpdate(Http3Connection
the connection
conn
,
Throwable
the exception
throwable
)

Does nothing

public void
onConnectionEstablished(Http3Connection
the connection or null
conn
,
Throwable
the exception or null
throwable
)

This method may update the HttpClient registry, or record the unsuccessful direct connection attempt.

Method Detail

noUpdateback to summary
public static void noUpdate(Http3Connection conn, Throwable throwable)

Does nothing

Parameters
conn:Http3Connection

the connection

throwable:Throwable

the exception

onConnectionEstablishedback to summary
public void onConnectionEstablished(Http3Connection conn, Throwable throwable)

This method may update the HttpClient registry, or record the unsuccessful direct connection attempt.

Parameters
conn:Http3Connection

the connection or null

throwable:Throwable

the exception or null

jdk.internal.net.http back to summary

pack-priv Class HttpQuicConnection.H3QuicConnectionImpl

extends HttpQuicConnection
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final HttpQuicConnection.DirectConnectionUpdater
private final Optional<Duration>
Inherited from jdk.internal.net.http.HttpQuicConnection:
debugquicConnectionquicConnTerminator

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv ConnectionPool.CacheKey
pack-priv NetworkChannel
public final void
close()

Implements abstract jdk.internal.net.http.HttpConnection.close.

Implements java.io.Closeable.close.

Closes this connection.

pack-priv void
close(final Throwable cause)

Implements abstract jdk.internal.net.http.HttpQuicConnection.close.

Closes this connection due to the given cause.

public CompletableFuture<Void>
connectAsync(Exchange<?> exchange)

Implements abstract jdk.internal.net.http.HttpQuicConnection.connectAsync.

Initiates the connect phase.

public void
connectionEstablished(Http3Connection connection, Throwable throwable)

Implements abstract jdk.internal.net.http.HttpQuicConnection.connectionEstablished.

Called when the HTTP/3 connection is established, either successfully or unsuccessfully

private <U> CompletableFuture<U>
Inherited from jdk.internal.net.http.HttpQuicConnection:
closeconnectedfinishConnectgetConnectionFlowgetHttpQuicConnectiongetSNIServerNamesgetSourceAltServiceisFlowFinishedisProxiedisSecureisTunnelproxypublisherquicConnectionquicDbgStringregisterUnadvertisedtoString

Field Detail

connFinishedActionback to summary
private final HttpQuicConnection.DirectConnectionUpdater connFinishedAction
directTimeoutback to summary
private final Optional<Duration> directTimeout

Constructor Detail

H3QuicConnectionImplback to summary
pack-priv H3QuicConnectionImpl(Origin originServer, InetSocketAddress address, HttpClientImpl client, QuicConnection quic, HttpQuicConnection.DirectConnectionUpdater connFinishedAction, Optional<Duration> directTimeout, AltServicesRegistry.AltService sourceAltService)

Method Detail

cacheKeyback to summary
pack-priv ConnectionPool.CacheKey cacheKey()

Implements abstract jdk.internal.net.http.HttpQuicConnection.cacheKey.

Annotations
@Override
channelback to summary
pack-priv NetworkChannel channel()

Implements abstract jdk.internal.net.http.HttpQuicConnection.channel.

Annotations
@Override
closeback to summary
public final void close()

Implements abstract jdk.internal.net.http.HttpConnection.close.

Implements java.io.Closeable.close.

Doc from jdk.internal.net.http.HttpConnection.close.

Closes this connection.

Annotations
@Override
closeback to summary
pack-priv void close(final Throwable cause)

Implements abstract jdk.internal.net.http.HttpQuicConnection.close.

Doc from jdk.internal.net.http.HttpConnection.close.

Closes this connection due to the given cause.

Annotations
@Override
connectAsyncback to summary
public CompletableFuture<Void> connectAsync(Exchange<?> exchange)

Implements abstract jdk.internal.net.http.HttpQuicConnection.connectAsync.

Doc from jdk.internal.net.http.HttpQuicConnection.connectAsync.

Initiates the connect phase. Returns a CompletableFuture that completes when the underlying TCP connection has been established or an error occurs.

Annotations
@Override
connectionEstablishedback to summary
public void connectionEstablished(Http3Connection connection, Throwable throwable)

Implements abstract jdk.internal.net.http.HttpQuicConnection.connectionEstablished.

Doc from jdk.internal.net.http.HttpQuicConnection.connectionEstablished.

Called when the HTTP/3 connection is established, either successfully or unsuccessfully

Annotations
@Override
handleTimeoutback to summary
private <U> CompletableFuture<U> handleTimeout(CompletableFuture<U> r, Throwable t)