Top Description Inners Fields Constructors Methods
io.vertx.core.http.impl

public Class Http1xClientConnection

extends Http1xConnectionBase<WebSocketImpl>
implements HttpClientConnection
Class Inheritance
All Implemented Interfaces
io.vertx.core.http.impl.HttpClientConnection, io.vertx.core.http.HttpConnection
Imports
io.netty.buffer.ByteBuf, .Unpooled, io.netty.channel.ChannelHandler, .ChannelHandlerContext, .ChannelPipeline, .EventLoop, io.netty.handler.codec.DecoderResult, io.netty.handler.codec.compression.Brotli, .ZlibCodecFactory, io.netty.handler.codec.http.HttpHeaders, io.netty.handler.codec.http.*, io.netty.handler.codec.http.websocketx.WebSocketFrame, io.netty.handler.codec.http.websocketx.*, io.netty.handler.codec.http.websocketx.extensions.WebSocketClientExtensionHandler, .WebSocketClientExtensionHandshaker, io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameClientExtensionHandshaker, .PerMessageDeflateClientExtensionHandshaker, .PerMessageDeflateServerExtensionHandshaker, io.netty.handler.timeout.IdleStateEvent, io.netty.util.ReferenceCountUtil, io.netty.util.concurrent.FutureListener, io.vertx.core.*, io.vertx.core.buffer.Buffer, io.vertx.core.http.HttpMethod, .HttpVersion, io.vertx.core.http.*, io.vertx.core.http.impl.headers.HeadersAdaptor, io.vertx.core.impl.ContextInternal, io.vertx.core.impl.future.PromiseInternal, io.vertx.core.impl.logging.Logger, .LoggerFactory, io.vertx.core.net.SocketAddress, io.vertx.core.net.impl.NetSocketImpl, .NetSocketInternal, .VertxHandler, io.vertx.core.spi.metrics.ClientMetrics, .HttpClientMetrics, io.vertx.core.spi.tracing.SpanKind, .TagExtractor, .VertxTracer, io.vertx.core.streams.WriteStream, io.vertx.core.streams.impl.InboundBuffer, java.net.URI, java.util.*, java.util.concurrent.TimeUnit, java.util.function.BiConsumer

This class is optimised for performance when used on the same event loop. However it can be used safely from other threads. The internal state is protected using the synchronized keyword. If always used on the same event loop, then we benefit from biased locking which makes the overhead of synchronized near zero.
Author
Tim Fox

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
private static class
Http1xClientConnection.StreamImpl

We split the stream class in two classes so that the base Stream class defines the (mutable) state managed by the connection and this class defines the state managed by the stream implementation

Field Summary

Modifier and TypeField and Description
private final HttpClientBase
private boolean
private boolean
private boolean
private Handler<Void>
private long
private final long
private static final Handler<Object>
private Handler<Object>
private boolean
private int
private long
private static final Logger
private final long
public final ClientMetrics<M, T, Req, Resp>
private final HttpClientOptions
private long
private Deque<Http1xClientConnection.Stream>
private Deque<Http1xClientConnection.Stream>
private int
private final SocketAddress
private boolean
private long
private final boolean
private final HttpVersion
private boolean
private long
Inherited from io.vertx.core.http.impl.Http1xConnectionBase:
webSocket

Constructor Summary

AccessConstructor and Description
pack-priv
Http1xClientConnection(HttpVersion version, HttpClientBase client, ChannelHandlerContext channel, boolean ssl, SocketAddress server, ContextInternal context, ClientMetrics<M, T, Req, Resp> metrics)

Method Summary

Modifier and TypeMethod and Description
private void
ackBytes(int len)

public synchronized long
private void
beginRequest(Http1xClientConnection.Stream stream, HttpRequestHead request, boolean chunked, ByteBuf buf, boolean end, boolean connect, Handler<AsyncResult<Void>> handler)

private void
public Future<Void>
close()

Overrides io.vertx.core.http.impl.Http1xConnectionBase.close.

Implements io.vertx.core.http.HttpConnection.close.

Like close(Handler) but returns a Future of the asynchronous result

public long
public HttpClientConnection
concurrencyChangeHandler(Handler<Long>
the handler
handler
)

Implements io.vertx.core.http.impl.HttpClientConnection.concurrencyChangeHandler.

Set a handler called when the connection concurrency changes.

private HttpRequest
createRequest(HttpMethod method, String uri, MultiMap headerMap, String authority, boolean chunked, ByteBuf buf, boolean end)

public Future<HttpClientRequest>
createRequest(ContextInternal
the stream context
context
)

Implements io.vertx.core.http.impl.HttpClientConnection.createRequest.

Create an HTTP stream.

public void
createStream(ContextInternal
the stream context
context
,
Handler<AsyncResult<HttpClientStream>>
the handler called when the stream is created
handler
)

Implements io.vertx.core.http.impl.HttpClientConnection.createStream.

Create an HTTP stream.

pack-priv static CharSequence
private void
public HttpClientConnection
evictionHandler(Handler<Void>
the handler
handler
)

Implements io.vertx.core.http.impl.HttpClientConnection.evictionHandler.

Set a handler called when the connection should be evicted from a pool.

private static long

Returns:

the expiration timestamp
expirationTimestampOf
(long
the timeout
timeout
)

Compute the expiration timeout of the connection, relative to the current time.

private WebSocketImpl
finish(ContextInternal context, WebSocketVersion version, boolean registerWriteHandlers, WebSocketClientHandshaker handshaker, MultiMap headers)

private void
protected void
public void
private void
protected void
handleIdle(IdleStateEvent event)

Overrides io.vertx.core.net.impl.ConnectionBase.handleIdle.

Called by the Netty handler when the connection becomes idle.

public void
public void
private void
private void
private void
pack-priv ArrayList<WebSocketClientExtensionHandshaker>
private static boolean
public boolean
public long
public HttpClientMetrics<R, W, S, T>
pack-priv static WebSocketClientHandshaker
newHandshaker(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, boolean allowOriginHeader, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking)

private void
receiveBytes(int len)

private void

Returns:

the messages emitted by the removed handlers during their removal
removeChannelHandlers
()

Remove all HTTP channel handlers of this connection

private boolean

Returns:

whether the stream should be considered as closed
reset
(Http1xClientConnection.Stream
to reset
stream
)

Resets the given stream.

public Future<Void>
shutdown(long timeout, TimeUnit unit)

Overrides io.vertx.core.http.impl.Http1xConnectionBase.shutdown.

Implements io.vertx.core.http.HttpConnection.shutdown.

Like shutdown(long, TimeUnit, Handler) but returns a Future of the asynchronous result

private void
shutdown(long timeoutMs, PromiseInternal<Void> promise)

private synchronized void
public NetSocketInternal

Returns:

a raw NetSocket - for internal use - must be called from event-loop
toNetSocket
()

pack-priv synchronized void
toWebSocket(ContextInternal context, String requestURI, MultiMap headers, boolean allowOriginHeader, WebsocketVersion vers, List<String> subProtocols, long handshakeTimeout, boolean registerWriteHandlers, int maxWebSocketFrameSize, Promise<WebSocket> promise)

private Throwable
private void
Inherited from io.vertx.core.http.impl.Http1xConnectionBase:
closeHandlerexceptionHandlergoAwaygoAwayHandlerhandleWsFramepingpingpingHandlerremoteSettingsremoteSettingsHandlersettingsshutdownHandlersizeofupdateSettingsupdateSettings