Package io.vertx.rxjava3.core.http
Class HttpConnection
- java.lang.Object
-
- io.vertx.rxjava3.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(io.vertx.core.Handler<java.lang.Void>)exceptionHandler(io.vertx.core.Handler<java.lang.Throwable>)
originalnon RX-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(HttpConnection delegate)HttpConnection(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.reactivex.rxjava3.core.Completableclose()Close the connection and all the currently active streams.HttpConnectioncloseHandler(Handler<Void> handler)Set a close handler.booleanequals(Object o)HttpConnectionexceptionHandler(Handler<Throwable> handler)Set an handler called when a connection error happensHttpConnectiongetDelegate()intgetWindowSize()HttpConnectiongoAway(long errorCode)LikegoAway(long)with a last stream id-1which means to disallow any new stream creation.HttpConnectiongoAway(long errorCode, int lastStreamId)LikegoAway(long)with no buffer.HttpConnectiongoAway(long errorCode, int lastStreamId, Buffer debugData)Send a go away frame to the remote endpoint of the connection.HttpConnectiongoAwayHandler(Handler<GoAway> handler)Set an handler called when a frame is received.inthashCode()StringindicatedServerName()Returns the SNI server name presented during the SSL handshake by the client.booleanisSsl()SocketAddresslocalAddress()SocketAddresslocalAddress(boolean real)static HttpConnectionnewInstance(HttpConnection arg)io.reactivex.rxjava3.core.Single<Buffer>ping(Buffer data)Send a frame to the remote endpoint.HttpConnectionpingHandler(Handler<Buffer> handler)Set an handler notified when a frame is received from the remote endpoint.SocketAddressremoteAddress()SocketAddressremoteAddress(boolean real)Http2SettingsremoteSettings()HttpConnectionremoteSettingsHandler(Handler<Http2Settings> handler)Set an handler that is called when remote endpointHttp2Settingsare updated.io.reactivex.rxjava3.core.CompletablerxClose()Close the connection and all the currently active streams.io.reactivex.rxjava3.core.Single<Buffer>rxPing(Buffer data)Send a frame to the remote endpoint.io.reactivex.rxjava3.core.CompletablerxShutdown()Initiate a graceful connection shutdown, the connection is taken out of service and closed when all current requests are processed, otherwise after 30 seconds the connection will be closed.io.reactivex.rxjava3.core.CompletablerxShutdown(long timeout)Likeshutdown()but with a specifictimeoutin milliseconds.io.reactivex.rxjava3.core.CompletablerxUpdateSettings(Http2Settings settings)Send to the remote endpoint an update of this endpoint settingsHttp2Settingssettings()HttpConnectionsetWindowSize(int windowSize)Update the current connection wide window size to a new size.io.reactivex.rxjava3.core.Completableshutdown()Initiate a graceful connection shutdown, the connection is taken out of service and closed when all current requests are processed, otherwise after 30 seconds the connection will be closed.io.reactivex.rxjava3.core.Completableshutdown(long timeout)Likeshutdown()but with a specifictimeoutin milliseconds.HttpConnectionshutdownHandler(Handler<Void> handler)Set an handler called when a frame has been sent or received and all connections are closed.SSLSessionsslSession()StringtoString()io.reactivex.rxjava3.core.CompletableupdateSettings(Http2Settings settings)Send to the remote endpoint an update of this endpoint settings
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<HttpConnection> __TYPE_ARG
-
-
Constructor Detail
-
HttpConnection
public HttpConnection(HttpConnection delegate)
-
HttpConnection
public HttpConnection(Object delegate)
-
-
Method Detail
-
getDelegate
public HttpConnection getDelegate()
-
getWindowSize
public int getWindowSize()
- Returns:
- the current connection window size or
-1for HTTP/1.x
-
setWindowSize
public HttpConnection setWindowSize(int windowSize)
Update the current connection wide window size to a new size. Increasing this value, gives better performance when several data streams are multiplexed This is not implemented for HTTP/1.x.- Parameters:
windowSize- the new window size- Returns:
- a reference to this, so the API can be used fluently
-
goAway
public HttpConnection goAway(long errorCode)
LikegoAway(long)with a last stream id-1which means to disallow any new stream creation.- Parameters:
errorCode-- Returns:
-
goAway
public HttpConnection goAway(long errorCode, int lastStreamId)
LikegoAway(long)with no buffer.- Parameters:
errorCode-lastStreamId-- Returns:
-
goAway
public HttpConnection goAway(long errorCode, int lastStreamId, Buffer debugData)
Send a go away frame to the remote endpoint of the connection.- a frame is sent to the to the remote endpoint with the
errorCodeanddebugData - any stream created after the stream identified by
lastStreamIdwill be closed - for an is different than
0when all the remaining streams are closed this connection will be closed automatically
- 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
- a frame is sent to the to the remote endpoint with the
-
goAwayHandler
public HttpConnection goAwayHandler(Handler<GoAway> handler)
Set an handler called when a frame is received. This is not implemented for HTTP/1.x.- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
shutdownHandler
public HttpConnection shutdownHandler(Handler<Void> handler)
Set an handler called when a frame has been sent or received and all connections are closed. This is not implemented for HTTP/1.x.- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
shutdown
public io.reactivex.rxjava3.core.Completable shutdown()
Initiate a graceful connection shutdown, the connection is taken out of service and closed when all current requests are processed, otherwise after 30 seconds the connection will be closed. Client connection are immediately removed from the pool.- HTTP/2 connections will send a go away frame immediately to signal the other side the connection will close
- HTTP/1.x client connection supports this feature
- HTTP/1.x server connections do not support this feature
- Returns:
-
rxShutdown
public io.reactivex.rxjava3.core.Completable rxShutdown()
Initiate a graceful connection shutdown, the connection is taken out of service and closed when all current requests are processed, otherwise after 30 seconds the connection will be closed. Client connection are immediately removed from the pool.- HTTP/2 connections will send a go away frame immediately to signal the other side the connection will close
- HTTP/1.x client connection supports this feature
- HTTP/1.x server connections do not support this feature
- Returns:
-
shutdown
public io.reactivex.rxjava3.core.Completable shutdown(long timeout)
Likeshutdown()but with a specifictimeoutin milliseconds.- Parameters:
timeout-- Returns:
-
rxShutdown
public io.reactivex.rxjava3.core.Completable rxShutdown(long timeout)
Likeshutdown()but with a specifictimeoutin milliseconds.- Parameters:
timeout-- Returns:
-
closeHandler
public HttpConnection closeHandler(Handler<Void> handler)
Set a close handler. The handler will get notified when the connection is closed.- Parameters:
handler- the handler to be notified- Returns:
- a reference to this, so the API can be used fluently
-
close
public io.reactivex.rxjava3.core.Completable close()
Close the connection and all the currently active streams. An HTTP/2 connection will send a frame before.- Returns:
-
rxClose
public io.reactivex.rxjava3.core.Completable rxClose()
Close the connection and all the currently active streams. An HTTP/2 connection will send a frame before.- Returns:
-
settings
public Http2Settings settings()
- Returns:
- the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x
-
updateSettings
public io.reactivex.rxjava3.core.Completable updateSettings(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.- Parameters:
settings- the new settings- Returns:
- a reference to this, so the API can be used fluently
-
rxUpdateSettings
public io.reactivex.rxjava3.core.Completable rxUpdateSettings(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.- Parameters:
settings- the new settings- Returns:
- a reference to this, so the API can be used fluently
-
remoteSettings
public Http2Settings remoteSettings()
- Returns:
- the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x
-
remoteSettingsHandler
public HttpConnection remoteSettingsHandler(Handler<Http2Settings> handler)
Set an handler that is called when remote endpointHttp2Settingsare updated. This is not implemented for HTTP/1.x.- Parameters:
handler- the handler for remote endpoint settings- Returns:
- a reference to this, so the API can be used fluently
-
ping
public io.reactivex.rxjava3.core.Single<Buffer> ping(Buffer data)
Send a frame to the remote endpoint. This is not implemented for HTTP/1.x.- Parameters:
data- the 8 bytes data of the frame- Returns:
- a reference to this, so the API can be used fluently
-
rxPing
public io.reactivex.rxjava3.core.Single<Buffer> rxPing(Buffer data)
Send a frame to the remote endpoint. This is not implemented for HTTP/1.x.- 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(Handler<Buffer> handler)
Set an handler notified when a frame is received from the remote endpoint. This is not implemented for HTTP/1.x.- 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(Handler<Throwable> handler)
Set an handler called when a connection error happens- 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). IfuseProxyProtocolis set totrue, the address returned will be of the actual connecting client.
-
remoteAddress
public SocketAddress remoteAddress(boolean real)
- Parameters:
real-- Returns:
-
localAddress
public SocketAddress localAddress()
- Returns:
- the local address for this connection, possibly
null(e.g a server bound on a domain socket) IfuseProxyProtocolis set totrue, the address returned will be of the proxy.
-
localAddress
public SocketAddress localAddress(boolean real)
- Parameters:
real-- Returns:
-
isSsl
public boolean isSsl()
- Returns:
- true if this
HttpConnectionis encrypted via SSL/TLS.
-
indicatedServerName
public String indicatedServerName()
Returns the SNI server name presented during the SSL handshake by the client.- Returns:
- the indicated server name
-
sslSession
public SSLSession sslSession()
- Returns:
- SSLSession associated with the underlying socket. Returns null if connection is not SSL.
-
newInstance
public static HttpConnection newInstance(HttpConnection arg)
-
-