Class: Vertx::HttpConnection
- Inherits:
-
Object
- Object
- Vertx::HttpConnection
- Defined in:
- /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb
Overview
Represents an HTTP connection.
HTTP/1.x connection provides an limited implementation, the following methods are implemented:
Instance Method Summary (collapse)
-
- (void) 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
@return 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.
-
- (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.
-
- (Hash) remote_settings
@return 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 Hash are updated.
-
- (self) set_window_size(windowSize = nil)
Update the current connection wide window size to a new size.
-
- (Hash) settings
@return 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.
-
- (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.
Instance Method Details
- (void) close
This method returns an undefined value.
Close the connection and all the currently active streams. An HTTP/2 connection will send a frame before.
126 127 128 129 130 131 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 126 def close if !block_given? return @j_del.java_method(:close, []).call() 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.
115 116 117 118 119 120 121 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 115 def close_handler if block_given? @j_del.java_method(:closeHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield }) return self end raise ArgumentError, "Invalid arguments when calling close_handler()" end |
- (self) exception_handler { ... }
Set an handler called when a connection error happens
206 207 208 209 210 211 212 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 206 def exception_handler if block_given? @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) })) return self end raise ArgumentError, "Invalid arguments when calling exception_handler()" end |
- (Fixnum) get_window_size
@return the current connection window size or
-1 for HTTP/1.x
26 27 28 29 30 31 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 26 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
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 59 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.
77 78 79 80 81 82 83 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 77 def go_away_handler if block_given? @j_del.java_method(:goAwayHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling go_away_handler()" end |
- (self) ping(data = nil) { ... }
Send a frame to the remote endpoint.
This is not implemented for HTTP/1.x.
184 185 186 187 188 189 190 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 184 def ping(data=nil) if data.class.method_defined?(:j_del) && block_given? @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) })) 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.
196 197 198 199 200 201 202 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 196 def ping_handler if block_given? @j_del.java_method(:pingHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Buffer)) })) return self end raise ArgumentError, "Invalid arguments when calling ping_handler()" end |
- (Hash) remote_settings
@return the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x
160 161 162 163 164 165 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 160 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 Hash are updated.
This is not implemented for HTTP/1.x.
171 172 173 174 175 176 177 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 171 def remote_settings_handler if block_given? @j_del.java_method(:remoteSettingsHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) })) 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.
39 40 41 42 43 44 45 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 39 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) settings
@return the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x
134 135 136 137 138 139 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 134 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.
102 103 104 105 106 107 108 109 110 111 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 102 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.
89 90 91 92 93 94 95 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 89 def shutdown_handler if block_given? @j_del.java_method(:shutdownHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield }) return self end raise ArgumentError, "Invalid arguments when calling shutdown_handler()" 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.
148 149 150 151 152 153 154 155 156 157 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_connection.rb', line 148 def update_settings(settings=nil) if settings.class == Hash && !block_given? @j_del.java_method(:updateSettings, [Java::IoVertxCoreHttp::Http2Settings.java_class]).call(Java::IoVertxCoreHttp::Http2Settings.new(::Vertx::Util::Utils.to_json_object(settings))) return self elsif settings.class == Hash && block_given? @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) })) return self end raise ArgumentError, "Invalid arguments when calling update_settings(settings)" end |