Class: Vertx::HttpConnection

Inherits:
Object
  • Object
show all
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)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 28

def @@j_api_type.accept?(obj)
  obj.class == HttpConnection
end

+ (Object) j_api_type



37
38
39
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 37

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



40
41
42
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 40

def self.j_class
  Java::IoVertxCoreHttp::HttpConnection.java_class
end

+ (Object) unwrap(obj)



34
35
36
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 34

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 31

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.

Returns:



315
316
317
318
319
320
321
322
323
324
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 315

def close
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:close, []).call(),::Vertx::Future, nil)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling close()"
  end
end

- (self) closeHandler(handler) { ... }

Set a close handler. The handler will get notified when the connection is closed.

Yields:

  • the handler to be notified

Returns:

  • (self)


191
192
193
194
195
196
197
198
199
200
201
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 191

def close_handler
  if true
    @j_del.java_method(:closeHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(nil) unless !block_given? }))
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling close_handler()"
  end
end

- (self) exceptionHandler(handler) { ... }

Set an handler called when a connection error happens

Yields:

  • the handler

Returns:

  • (self)


299
300
301
302
303
304
305
306
307
308
309
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 299

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling exception_handler()"
  end
end

- (Fixnum) getWindowSize

Returns the current connection window size or -1 for HTTP/1.x

Returns:

  • (Fixnum)
    the current connection window size or -1 for HTTP/1.x


57
58
59
60
61
62
63
64
65
66
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 57

def get_window_size
  if !block_given?
    return @j_del.java_method(:getWindowSize, []).call()
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_window_size()"
  end
end

- (self) goAway(errorCode) - (self) goAway(errorCode, lastStreamId) - (self) goAway(errorCode, lastStreamId, 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 errorCode and debugData
  • any stream created after the stream identified by lastStreamId will be closed
  • for an is different than 0 when all the remaining streams are closed this connection will be closed automatically

This is not implemented for HTTP/1.x.

Overloads:

  • - (self) goAway(errorCode)

    Parameters:

    • errorCode (Fixnum)
  • - (self) goAway(errorCode, lastStreamId)

    Parameters:

    • errorCode (Fixnum)
    • lastStreamId (Fixnum)
  • - (self) goAway(errorCode, lastStreamId, debugData)

    Parameters:

    • errorCode (Fixnum)
      the error code
    • lastStreamId (Fixnum)
      the last stream id
    • debugData (::Vertx::Buffer)
      additional debug data sent to the remote endpoint

Returns:

  • (self)


127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 127

def go_away(*args)
  if args[0].class == Fixnum && !block_given? && args[1] == nil && args[2] == nil
    @j_del.java_method(:goAway, [Java::long.java_class]).call(args[0])
    return self
  elsif args[0].class == Fixnum && args[1].class == Fixnum && !block_given? && args[2] == nil
    @j_del.java_method(:goAway, [Java::long.java_class,Java::int.java_class]).call(args[0],args[1])
    return self
  elsif args[0].class == Fixnum && args[1].class == Fixnum && args[2].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(args[0],args[1],args[2].j_del)
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling go_away(#{args[0]},#{args[1]},#{args[2]})"
  end
end

- (self) goAwayHandler(handler) { ... }

Set an handler called when a frame is received.

This is not implemented for HTTP/1.x.

Yields:

  • the handler

Returns:

  • (self)


97
98
99
100
101
102
103
104
105
106
107
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 97

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling go_away_handler()"
  end
end

- (String) indicatedServerName

Returns the SNI server name presented during the SSL handshake by the client.

Returns:

  • (String)
    the indicated server name


217
218
219
220
221
222
223
224
225
226
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 217

def indicated_server_name
  if !block_given?
    return @j_del.java_method(:indicatedServerName, []).call()
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling indicated_server_name()"
  end
end

- (::Vertx::SocketAddress) localAddress

Returns the remote address for this connection

Returns:



229
230
231
232
233
234
235
236
237
238
239
240
241
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 229

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling local_address()"
  end
end

- (self) ping(data, pongHandler) { ... }

Send a frame to the remote endpoint.

This is not implemented for HTTP/1.x.

Parameters:

Yields:

  • an async result handler notified with pong reply or the failure

Returns:

  • (self)


74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 74

def ping(*args)
  if args[0].class.method_defined?(:j_del) && true
    if (block_given?)
      @j_del.java_method(:ping, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Buffer) : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:ping, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Buffer) : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Buffer.j_api_type)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling ping(#{args[0]})"
  end
end

- (self) pingHandler(handler) { ... }

Set an handler notified when a frame is received from the remote endpoint.

This is not implemented for HTTP/1.x.

Yields:

  • the handler to be called when a is received

Returns:

  • (self)


150
151
152
153
154
155
156
157
158
159
160
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 150

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling ping_handler()"
  end
end

- (::Vertx::SocketAddress) remoteAddress

Returns the remote address for this connection

Returns:



327
328
329
330
331
332
333
334
335
336
337
338
339
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 327

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling remote_address()"
  end
end

- (Hash{String => Object}) remoteSettings

Returns the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x

Returns:

  • (Hash{String => Object})
    the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x


204
205
206
207
208
209
210
211
212
213
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 204

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling remote_settings()"
  end
end

- (self) remoteSettingsHandler(handler) { ... }

Set an handler that is called when remote endpoint => Object} are updated.

This is not implemented for HTTP/1.x.

Yields:

  • the handler for remote endpoint settings

Returns:

  • (self)


265
266
267
268
269
270
271
272
273
274
275
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 265

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling remote_settings_handler()"
  end
end

- (self) setWindowSize(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 (Fixnum)
    the new window size

Returns:

  • (self)


284
285
286
287
288
289
290
291
292
293
294
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 284

def set_window_size(*args)
  if args[0].class == Fixnum && !block_given?
    @j_del.java_method(:setWindowSize, [Java::int.java_class]).call(args[0])
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling set_window_size(#{args[0]})"
  end
end

- (Hash{String => Object}) settings

Returns the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x

Returns:

  • (Hash{String => Object})
    the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x


45
46
47
48
49
50
51
52
53
54
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 45

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling settings()"
  end
end

- (self) shutdown - (self) shutdown(timeoutMs)

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.

Overloads:

  • - (self) shutdown(timeoutMs)

    Parameters:

    • timeoutMs (Fixnum)
      the timeout in milliseconds

Returns:

  • (self)


348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 348

def shutdown(*args)
  if !block_given? && args[0] == nil
    @j_del.java_method(:shutdown, []).call()
    return self
  elsif args[0].class == Fixnum && !block_given?
    @j_del.java_method(:shutdown, [Java::long.java_class]).call(args[0])
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling shutdown(#{args[0]})"
  end
end

- (self) shutdownHandler(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.

Yields:

  • the handler

Returns:

  • (self)


248
249
250
251
252
253
254
255
256
257
258
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 248

def shutdown_handler
  if true
    @j_del.java_method(:shutdownHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(nil) unless !block_given? }))
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling shutdown_handler()"
  end
end

- (true, false) isSsl

Returns true if this Vertx::HttpConnection is encrypted via SSL/TLS.

Returns:



364
365
366
367
368
369
370
371
372
373
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 364

def ssl?
  if !block_given?
    return @j_del.java_method(:isSsl, []).call()
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling ssl?()"
  end
end

- (self) updateSettings(settings, completionHandler) { ... }

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.

Parameters:

  • settings (Hash{String => Object})
    the new settings

Yields:

  • the handler notified when the settings have been acknowledged by the remote endpoint

Returns:

  • (self)


170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_connection.rb', line 170

def update_settings(*args)
  if args[0].class == Hash && true
    if (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(args[0])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @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(args[0])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling update_settings(#{args[0]})"
  end
end