Class HttpConnection
- java.lang.Object
-
- io.vertx.mutiny.core.http.HttpConnection
-
public class HttpConnection extends Object
Represents an HTTP connection. HTTP/1.x connection provides an limited implementation, the following methods are implemented:close()closeHandler(java.util.function.Consumer<java.lang.Void>)exceptionHandler(java.util.function.Consumer<java.lang.Throwable>)
originalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<HttpConnection>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description HttpConnection(io.vertx.core.http.HttpConnection delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()HttpConnectioncloseHandler(Consumer<Void> handler)booleanequals(Object o)HttpConnectionexceptionHandler(Consumer<Throwable> handler)io.vertx.core.http.HttpConnectiongetDelegate()intgetWindowSize()HttpConnectiongoAway(long errorCode)HttpConnectiongoAway(long errorCode, int lastStreamId)HttpConnectiongoAway(long errorCode, int lastStreamId, Buffer debugData)HttpConnectiongoAwayHandler(Consumer<io.vertx.core.http.GoAway> handler)inthashCode()StringindicatedServerName()booleanisSsl()SocketAddresslocalAddress()static HttpConnectionnewInstance(io.vertx.core.http.HttpConnection arg)io.smallrye.mutiny.Uni<Buffer>ping(Buffer data)Send a frame to the remote endpoint.BufferpingAndAwait(Buffer data)Blocking variant ofping(io.vertx.mutiny.core.buffer.Buffer).HttpConnectionpingHandler(Consumer<Buffer> handler)SocketAddressremoteAddress()io.vertx.core.http.Http2SettingsremoteSettings()HttpConnectionremoteSettingsHandler(Consumer<io.vertx.core.http.Http2Settings> handler)io.vertx.core.http.Http2Settingssettings()HttpConnectionsetWindowSize(int windowSize)HttpConnectionshutdown()HttpConnectionshutdown(long timeoutMs)HttpConnectionshutdownHandler(Consumer<Void> handler)SSLSessionsslSession()StringtoString()io.smallrye.mutiny.Uni<Void>updateSettings(io.vertx.core.http.Http2Settings settings)Send to the remote endpoint an update of this endpoint settingsVoidupdateSettingsAndAwait(io.vertx.core.http.Http2Settings settings)Blocking variant ofupdateSettings(Http2Settings).HttpConnectionupdateSettingsAndForget(io.vertx.core.http.Http2Settings settings)Variant ofupdateSettings(Http2Settings)that ignores the result of the operation.
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<HttpConnection> __TYPE_ARG
-
-
Method Detail
-
getDelegate
public io.vertx.core.http.HttpConnection getDelegate()
-
getWindowSize
public int getWindowSize()
- Returns:
- the current connection window size or
-1for HTTP/1.x
-
setWindowSize
public HttpConnection setWindowSize(int windowSize)
- Parameters:
windowSize- the new window size- Returns:
- a reference to this, so the API can be used fluently
-
goAway
public HttpConnection goAway(long errorCode)
- Parameters:
errorCode-- Returns:
-
goAway
public HttpConnection goAway(long errorCode, int lastStreamId)
- Parameters:
errorCode-lastStreamId-- Returns:
-
goAway
public HttpConnection goAway(long errorCode, int lastStreamId, Buffer debugData)
- Parameters:
errorCode- the error codelastStreamId- the last stream iddebugData- additional debug data sent to the remote endpoint- Returns:
- a reference to this, so the API can be used fluently
-
goAwayHandler
public HttpConnection goAwayHandler(Consumer<io.vertx.core.http.GoAway> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
shutdownHandler
public HttpConnection shutdownHandler(Consumer<Void> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
shutdown
public HttpConnection shutdown()
- Returns:
- a reference to this, so the API can be used fluently
-
shutdown
public HttpConnection shutdown(long timeoutMs)
- Parameters:
timeoutMs- the timeout in milliseconds- Returns:
- a reference to this, so the API can be used fluently
-
closeHandler
public HttpConnection closeHandler(Consumer<Void> handler)
- Parameters:
handler- the handler to be notified- Returns:
- a reference to this, so the API can be used fluently
-
close
public void close()
-
settings
public io.vertx.core.http.Http2Settings settings()
- Returns:
- the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x
-
updateSettings
public io.smallrye.mutiny.Uni<Void> updateSettings(io.vertx.core.http.Http2Settings settings)
Send to the remote endpoint an update of this endpoint settings ThecompletionHandlerwill be notified when the remote endpoint has acknowledged the settings. This is not implemented for HTTP/1.x.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
settings- the new settings- Returns:
- a reference to this, so the API can be used fluently
-
updateSettingsAndAwait
public Void updateSettingsAndAwait(io.vertx.core.http.Http2Settings settings)
Blocking variant ofupdateSettings(Http2Settings).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
settings- the new settings- Returns:
- a reference to this, so the API can be used fluently
-
remoteSettings
public io.vertx.core.http.Http2Settings remoteSettings()
- Returns:
- the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x
-
remoteSettingsHandler
public HttpConnection remoteSettingsHandler(Consumer<io.vertx.core.http.Http2Settings> handler)
- Parameters:
handler- the handler for remote endpoint settings- Returns:
- a reference to this, so the API can be used fluently
-
ping
public io.smallrye.mutiny.Uni<Buffer> ping(Buffer data)
Send a frame to the remote endpoint. This is not implemented for HTTP/1.x.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
data- the 8 bytes data of the frame- Returns:
- a reference to this, so the API can be used fluently
-
pingAndAwait
public Buffer pingAndAwait(Buffer data)
Blocking variant ofping(io.vertx.mutiny.core.buffer.Buffer).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
data- the 8 bytes data of the frame- Returns:
- a reference to this, so the API can be used fluently
-
pingHandler
public HttpConnection pingHandler(Consumer<Buffer> handler)
- Parameters:
handler- the handler to be called when a is received- Returns:
- a reference to this, so the API can be used fluently
-
exceptionHandler
public HttpConnection exceptionHandler(Consumer<Throwable> handler)
- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
remoteAddress
public SocketAddress remoteAddress()
- Returns:
- the remote address for this connection, possibly
null(e.g a server bound on a domain socket)
-
localAddress
public SocketAddress localAddress()
- Returns:
- the local address for this connection, possibly
null(e.g a server bound on a domain socket)
-
isSsl
public boolean isSsl()
- Returns:
- true if this
HttpConnectionis encrypted via SSL/TLS.
-
indicatedServerName
public String indicatedServerName()
- Returns:
- the indicated server name
-
sslSession
public SSLSession sslSession()
- Returns:
- SSLSession associated with the underlying socket. Returns null if connection is not SSL.
-
updateSettingsAndForget
public HttpConnection updateSettingsAndForget(io.vertx.core.http.Http2Settings settings)
Variant ofupdateSettings(Http2Settings)that ignores the result of the operation.This method subscribes on the result of
updateSettings(Http2Settings), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromupdateSettings(Http2Settings)but you don't need to compose it with other operations.- Parameters:
settings- the new settings- Returns:
- a reference to this, so the API can be used fluently
-
newInstance
public static HttpConnection newInstance(io.vertx.core.http.HttpConnection arg)
-
-