Class: Vertx::HttpConnection
- Inherits:
-
Object
- Object
- Vertx::HttpConnection
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb
Overview
Represents an HTTP connection.
HTTP/1.x connection provides an limited implementation, the following methods are implemented:
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (::Vertx::Future) close
Close the connection and all the currently active streams.
-
- (self) close_handler { ... }
Set a close handler.
-
- (self) exception_handler { ... }
Set an handler called when a connection error happens.
-
- (Fixnum) get_window_size
The current connection window size or -1 for HTTP/1.x.
-
- (self) go_away(errorCode = nil, lastStreamId = nil, debugData = nil)
Send a go away frame to the remote endpoint of the connection.
-
- (self) go_away_handler { ... }
Set an handler called when a frame is received.
-
- (String) indicated_server_name
Returns the SNI server name presented during the SSL handshake by the client.
-
- (::Vertx::SocketAddress) local_address
The remote address for this connection.
-
- (self) ping(data = nil) { ... }
Send a frame to the remote endpoint.
-
- (self) ping_handler { ... }
Set an handler notified when a frame is received from the remote endpoint.
-
- (::Vertx::SocketAddress) remote_address
The remote address for this connection.
-
- (Hash{String => Object}) remote_settings
The current remote endpoint settings for this connection - this is not implemented for HTTP/1.x.
-
- (self) remote_settings_handler { ... }
Set an handler that is called when remote endpoint => Object} are updated.
-
- (self) set_window_size(windowSize = nil)
Update the current connection wide window size to a new size.
-
- (Hash{String => Object}) settings
The latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x.
-
- (self) shutdown(timeoutMs = nil)
Initiate a connection shutdown, a go away frame is sent and the connection is closed when all current streams will be closed or the timeout is fired.
-
- (self) shutdown_handler { ... }
Set an handler called when a frame has been sent or received and all connections are closed.
-
- (true, false) ssl?
True if this HttpConnection is encrypted via SSL/TLS.
-
- (self) update_settings(settings = nil) { ... }
Send to the remote endpoint an update of this endpoint settings The completionHandler will be notified when the remote endpoint has acknowledged the settings.
Class Method Details
+ (Boolean) accept?(obj)
27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 27 def @@j_api_type.accept?(obj) obj.class == HttpConnection end |
+ (Object) j_api_type
36 37 38 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 36 def self.j_api_type @@j_api_type end |
+ (Object) j_class
39 40 41 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 39 def self.j_class Java::IoVertxCoreHttp::HttpConnection.java_class end |
+ (Object) unwrap(obj)
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 33 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 30 def @@j_api_type.wrap(obj) HttpConnection.new(obj) end |
Instance Method Details
- (::Vertx::Future) close
Close the connection and all the currently active streams.
An HTTP/2 connection will send a frame before.
143 144 145 146 147 148 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 143 def close if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:close, []).call(),::Vertx::Future, nil) end raise ArgumentError, "Invalid arguments when calling close()" end |
- (self) close_handler { ... }
Set a close handler. The handler will get notified when the connection is closed.
132 133 134 135 136 137 138 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 132 def close_handler if true @j_del.java_method(:closeHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield unless !block_given? }) return self end raise ArgumentError, "Invalid arguments when calling close_handler()" end |
- (self) exception_handler { ... }
Set an handler called when a connection error happens
218 219 220 221 222 223 224 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 218 def exception_handler if true @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling exception_handler()" end |
- (Fixnum) get_window_size
Returns the current connection window size or
-1 for HTTP/1.x
43 44 45 46 47 48 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 43 def get_window_size if !block_given? return @j_del.java_method(:getWindowSize, []).call() end raise ArgumentError, "Invalid arguments when calling get_window_size()" end |
- (self) go_away(errorCode = nil, lastStreamId = nil, debugData = nil)
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
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 76 def go_away(errorCode=nil,lastStreamId=nil,debugData=nil) if errorCode.class == Fixnum && !block_given? && lastStreamId == nil && debugData == nil @j_del.java_method(:goAway, [Java::long.java_class]).call(errorCode) return self elsif errorCode.class == Fixnum && lastStreamId.class == Fixnum && !block_given? && debugData == nil @j_del.java_method(:goAway, [Java::long.java_class,Java::int.java_class]).call(errorCode,lastStreamId) return self elsif errorCode.class == Fixnum && lastStreamId.class == Fixnum && debugData.class.method_defined?(:j_del) && !block_given? @j_del.java_method(:goAway, [Java::long.java_class,Java::int.java_class,Java::IoVertxCoreBuffer::Buffer.java_class]).call(errorCode,lastStreamId,debugData.j_del) return self end raise ArgumentError, "Invalid arguments when calling go_away(#{errorCode},#{lastStreamId},#{debugData})" end |
- (self) go_away_handler { ... }
Set an handler called when a frame is received.
This is not implemented for HTTP/1.x.
94 95 96 97 98 99 100 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 94 def go_away_handler if true @j_del.java_method(:goAwayHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling go_away_handler()" end |
- (String) indicated_server_name
Returns the SNI server name presented during the SSL handshake by the client.
254 255 256 257 258 259 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 254 def indicated_server_name if !block_given? return @j_del.java_method(:indicatedServerName, []).call() end raise ArgumentError, "Invalid arguments when calling indicated_server_name()" end |
- (::Vertx::SocketAddress) local_address
Returns the remote address for this connection
236 237 238 239 240 241 242 243 244 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 236 def local_address if !block_given? if @cached_local_address != nil return @cached_local_address end return @cached_local_address = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:localAddress, []).call(),::Vertx::SocketAddress) end raise ArgumentError, "Invalid arguments when calling local_address()" end |
- (self) ping(data = nil) { ... }
Send a frame to the remote endpoint.
This is not implemented for HTTP/1.x.
196 197 198 199 200 201 202 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 196 def ping(data=nil) if data.class.method_defined?(:j_del) && true @j_del.java_method(:ping, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoVertxCore::Handler.java_class]).call(data.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Buffer) : nil) } unless !block_given?)) return self end raise ArgumentError, "Invalid arguments when calling ping(#{data})" end |
- (self) ping_handler { ... }
Set an handler notified when a frame is received from the remote endpoint.
This is not implemented for HTTP/1.x.
208 209 210 211 212 213 214 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 208 def ping_handler if true @j_del.java_method(:pingHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Buffer)) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling ping_handler()" end |
- (::Vertx::SocketAddress) remote_address
Returns the remote address for this connection
226 227 228 229 230 231 232 233 234 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 226 def remote_address if !block_given? if @cached_remote_address != nil return @cached_remote_address end return @cached_remote_address = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:remoteAddress, []).call(),::Vertx::SocketAddress) end raise ArgumentError, "Invalid arguments when calling remote_address()" end |
- (Hash{String => Object}) remote_settings
Returns the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x
172 173 174 175 176 177 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 172 def remote_settings if !block_given? return @j_del.java_method(:remoteSettings, []).call() != nil ? JSON.parse(@j_del.java_method(:remoteSettings, []).call().toJson.encode) : nil end raise ArgumentError, "Invalid arguments when calling remote_settings()" end |
- (self) remote_settings_handler { ... }
Set an handler that is called when remote endpoint => Object} are updated.
This is not implemented for HTTP/1.x.
183 184 185 186 187 188 189 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 183 def remote_settings_handler if true @j_del.java_method(:remoteSettingsHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling remote_settings_handler()" end |
- (self) set_window_size(windowSize = nil)
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.
56 57 58 59 60 61 62 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 56 def set_window_size(windowSize=nil) if windowSize.class == Fixnum && !block_given? @j_del.java_method(:setWindowSize, [Java::int.java_class]).call(windowSize) return self end raise ArgumentError, "Invalid arguments when calling set_window_size(#{windowSize})" end |
- (Hash{String => Object}) settings
Returns the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x
150 151 152 153 154 155 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 150 def settings if !block_given? return @j_del.java_method(:settings, []).call() != nil ? JSON.parse(@j_del.java_method(:settings, []).call().toJson.encode) : nil end raise ArgumentError, "Invalid arguments when calling settings()" end |
- (self) shutdown(timeoutMs = nil)
Initiate a connection shutdown, a go away frame is sent and the connection is closed when all current streams
will be closed or the
timeout is fired.
This is not implemented for HTTP/1.x.
119 120 121 122 123 124 125 126 127 128 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 119 def shutdown(timeoutMs=nil) if !block_given? && timeoutMs == nil @j_del.java_method(:shutdown, []).call() return self elsif timeoutMs.class == Fixnum && !block_given? @j_del.java_method(:shutdown, [Java::long.java_class]).call(timeoutMs) return self end raise ArgumentError, "Invalid arguments when calling shutdown(#{timeoutMs})" end |
- (self) shutdown_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.
106 107 108 109 110 111 112 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 106 def shutdown_handler if true @j_del.java_method(:shutdownHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield unless !block_given? }) return self end raise ArgumentError, "Invalid arguments when calling shutdown_handler()" end |
- (true, false) ssl?
Returns true if this Vertx::HttpConnection is encrypted via SSL/TLS.
246 247 248 249 250 251 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 246 def ssl? if !block_given? return @j_del.java_method(:isSsl, []).call() end raise ArgumentError, "Invalid arguments when calling ssl?()" end |
- (self) update_settings(settings = nil) { ... }
Send to the remote endpoint an update of this endpoint settings
The
completionHandler will be notified when the remote endpoint has acknowledged the settings.
This is not implemented for HTTP/1.x.
164 165 166 167 168 169 170 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 164 def update_settings(settings=nil) if settings.class == Hash && true @j_del.java_method(:updateSettings, [Java::IoVertxCoreHttp::Http2Settings.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxCoreHttp::Http2Settings.new(::Vertx::Util::Utils.to_json_object(settings)),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) } unless !block_given?)) return self end raise ArgumentError, "Invalid arguments when calling update_settings(#{settings})" end |