Class: Vertx::HttpClientRequest

Inherits:
Future
  • Object
show all
Includes:
WriteStream
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb

Overview

Represents a client-side HTTP request.

Instances are created by an HttpClient instance, via one of the methods corresponding to the specific HTTP methods, or the generic request methods. On creation the request will not have been written to the wire.

Once a request has been obtained, headers can be set on it, and data can be written to its body if required. Once you are ready to send the request, one of the #end methods should be called.

Nothing is actually sent until the request has been internally assigned an HTTP connection.

The HttpClient instance will return an instance of this class immediately, even if there are no HTTP connections available in the pool. Any requests sent before a connection is assigned will be queued internally and actually sent when an HTTP connection becomes available from the pool.

The headers of the request are queued for writing either when the #end method is called, or, when the first part of the body is written, whichever occurs first.

This class supports both chunked and non-chunked HTTP.

It implements WriteStream so it can be used with Pump to pump data with flow control.

An example of using this class is as follows:

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Future

#cause, #complete?, #failed?, failed_future, future, #map_empty, #succeeded?, succeeded_future

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


51
52
53
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 51

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

+ (Object) j_api_type



60
61
62
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 60

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



63
64
65
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 63

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

+ (Object) unwrap(obj)



57
58
59
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 57

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

+ (Object) wrap(obj)



54
55
56
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 54

def @@j_api_type.wrap(obj)
  HttpClientRequest.new(obj)
end

Instance Method Details

- (String) absoluteURI

Returns the absolute URI corresponding to the the HTTP request

Returns:

  • (String)
    the absolute URI corresponding to the the HTTP request


143
144
145
146
147
148
149
150
151
152
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 143

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

- (true, false) isChunked

Returns Is the request chunked?

Returns:

  • (true, false)
    Is the request chunked?


237
238
239
240
241
242
243
244
245
246
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 237

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

- (::Vertx::Future) compose(mapper) { ... }

Compose this future with a mapper function.

When this future (the one on which compose is called) succeeds, the mapper will be called with the completed value and this mapper returns another future object. This returned future completion will complete the future returned by this method call.

If the mapper throws an exception, the returned future will be failed with this exception.

When this future fails, the failure will be propagated to the returned future and the mapper will not be called.

Yields:

  • the mapper function

Returns:



702
703
704
705
706
707
708
709
710
711
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 702

def compose(*args)
  if block_given? && args[0] == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:compose, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::HttpClientResponse)).j_del unless !block_given? })),::Vertx::Future, nil)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling compose(#{args[0]})"
  end
end

- (::Vertx::HttpConnection) connection

Returns the Vertx::HttpConnection associated with this request

Returns:



305
306
307
308
309
310
311
312
313
314
315
316
317
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 305

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

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

Set a connection handler called when an HTTP connection has been established.

Yields:

  • the handler

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_client_request.rb', line 265

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

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

If you send an HTTP request with the header Expect set to the value 100-continue and the server responds with an interim HTTP response with a status code of 100 and a continue handler has been set using this method, then the handler will be called.

You can then continue to write data to the request body and later end it. This is normally used in conjunction with the #send_head method to force the request header to be written before the request has ended.

Yields:

Returns:

  • (self)


646
647
648
649
650
651
652
653
654
655
656
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 646

def continue_handler
  if true
    @j_del.java_method(:continueHandler, [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 continue_handler()"
  end
end

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

Yields:

Returns:

  • (self)


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

def drain_handler
  if true
    @j_del.java_method(:drainHandler, [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 drain_handler()"
  end
end

- (void) end(handler) { ... } - (void) end(chunk, handler) { ... } - (void) end(chunk, handler) { ... } - (void) end(chunk, enc, handler) { ... }

This method returns an undefined value.

Same as #end but with an handler called when the operation completes

Overloads:

  • - (void) end(handler) { ... }

    Yields:

  • - (void) end(chunk, handler) { ... }

    Parameters:

    • chunk (String)

    Yields:

  • - (void) end(chunk, handler) { ... }

    Parameters:

    Yields:

  • - (void) end(chunk, enc, handler) { ... }

    Parameters:

    • chunk (String)
    • enc (String)

    Yields:



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 332

def end(*args)
  if true && args[0] == nil && args[1] == nil
    if (block_given?)
      return @j_del.java_method(:end, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:end, [Java::IoVertxCore::Handler.java_class]).call(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
  elsif args[0].class == String && true && args[1] == nil
    if (block_given?)
      return @j_del.java_method(:end, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:end, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(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
  elsif args[0].class.method_defined?(:j_del) && true && args[1] == nil
    if (block_given?)
      return @j_del.java_method(:end, [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 ? nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:end, [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 ? nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  elsif args[0].class == String && args[1].class == String && true
    if (block_given?)
      return @j_del.java_method(:end, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:end, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1],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 end(#{args[0]},#{args[1]})"
  end
end

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

Yields:

Returns:

  • (self)


773
774
775
776
777
778
779
780
781
782
783
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 773

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

- (Proc) getHandler

Returns the handler for the result

Returns:

  • (Proc)
    the handler for the result


170
171
172
173
174
175
176
177
178
179
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 170

def get_handler
  if !block_given?
    return ::Vertx::Util::Utils.to_async_result_handler_proc(@j_del.java_method(:getHandler, []).call()) { |val| val.j_del }
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_handler()"
  end
end

- (String) getHost

Returns the request host. For HTTP/2 it returns the pseudo header otherwise it returns the header

Returns:

  • (String)
    the request host. For HTTP/2 it returns the pseudo header otherwise it returns the header


487
488
489
490
491
492
493
494
495
496
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 487

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

- (String) getRawMethod

Returns the raw value of the method this request sends

Returns:

  • (String)
    the raw value of the method this request sends


374
375
376
377
378
379
380
381
382
383
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 374

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

- (Hash{String => Object}) getStreamPriority

Returns the priority of the associated HTTP/2 stream for HTTP/2 otherwise null

Returns:

  • (Hash{String => Object})
    the priority of the associated HTTP/2 stream for HTTP/2 otherwise null


659
660
661
662
663
664
665
666
667
668
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 659

def get_stream_priority
  if !block_given?
    return @j_del.java_method(:getStreamPriority, []).call() != nil ? JSON.parse(@j_del.java_method(:getStreamPriority, []).call().toJson.encode) : nil
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_stream_priority()"
  end
end

- (::Vertx::MultiMap) headers

Returns The HTTP headers

Returns:



521
522
523
524
525
526
527
528
529
530
531
532
533
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 521

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

- (::Vertx::Future) map(mapper) { ... }

Apply a mapper function on this future.

When this future succeeds, the mapper will be called with the completed value and this mapper returns a value. This value will complete the future returned by this method call.

If the mapper throws an exception, the returned future will be failed with this exception.

When this future fails, the failure will be propagated to the returned future and the mapper will not be called.

Yields:

  • the mapper function

Returns:



431
432
433
434
435
436
437
438
439
440
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 431

def map(*args)
  if block_given? && args[0] == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:map, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| ::Vertx::Util::Utils.to_object(yield(::Vertx::Util::Utils.safe_create(event,::Vertx::HttpClientResponse))) unless !block_given? })),::Vertx::Future, nil)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling map(#{args[0]})"
  end
end

- (:OPTIONS, ...) method

The HTTP method for the request.

Returns:

  • (:OPTIONS, :GET, :HEAD, :POST, :PUT, :DELETE, :TRACE, :CONNECT, :PATCH, :OTHER)


569
570
571
572
573
574
575
576
577
578
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 569

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

- (::Vertx::Future) otherwise(mapper) { ... } - (::Vertx::Future) otherwise(value)

Map the failure of a future to a specific value.

When this future fails, this value will complete the future returned by this method call.

When this future succeeds, the result will be propagated to the returned future.

Overloads:

Returns:



507
508
509
510
511
512
513
514
515
516
517
518
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 507

def otherwise(*args)
  if block_given? && args[0] == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:otherwise, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)).j_del unless !block_given? })),::Vertx::Future,::Vertx::HttpClientResponse.j_api_type)
  elsif args[0].class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:otherwise, [Java::IoVertxCoreHttp::HttpClientResponse.java_class]).call(args[0].j_del),::Vertx::Future,::Vertx::HttpClientResponse.j_api_type)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling otherwise(#{args[0]})"
  end
end

- (::Vertx::Future) otherwiseEmpty

Map the failure of a future to null.

This is a convenience for future.otherwise((T) null).

When this future fails, the null value will complete the future returned by this method call.

When this future succeeds, the result will be propagated to the returned future.

Returns:



627
628
629
630
631
632
633
634
635
636
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 627

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

- (String) path

Returns The path part of the uri. For example /somepath/somemorepath/someresource.foo

Returns:

  • (String)
    The path part of the uri. For example /somepath/somemorepath/someresource.foo


209
210
211
212
213
214
215
216
217
218
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 209

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

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

Set a push handler for this request.

The handler is called when the client receives a push promise from the server. The handler can be called multiple times, for each push promise.

The handler is called with a read-only Vertx::HttpClientRequest, the following methods can be called:

In addition the handler should call the #set_handler method to set an handler to process the response.

Yields:

  • the handler

Returns:

  • (self)


130
131
132
133
134
135
136
137
138
139
140
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 130

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

- (self) putHeader(name, value)

Put an HTTP header

Parameters:

  • name (String)
    The header name
  • value (String)
    The header value

Returns:

  • (self)


759
760
761
762
763
764
765
766
767
768
769
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 759

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

- (String) query

Returns the query part of the uri. For example someparam=32&someotherparam=x

Returns:

  • (String)
    the query part of the uri. For example someparam=32&someotherparam=x


581
582
583
584
585
586
587
588
589
590
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 581

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

- (::Vertx::Future) recover(mapper) { ... }

Handles a failure of this Future by returning the result of another Future. If the mapper fails, then the returned future will be failed with this failure.

Yields:

  • A function which takes the exception of a failure and returns a new future.

Returns:



556
557
558
559
560
561
562
563
564
565
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 556

def recover(*args)
  if block_given? && args[0] == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:recover, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)).j_del unless !block_given? })),::Vertx::Future,::Vertx::HttpClientResponse.j_api_type)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling recover(#{args[0]})"
  end
end

- (true, false) reset - (true, false) reset(code)

Reset this request:

  • for HTTP/2, this performs send an HTTP/2 reset frame with the specified error code
  • for HTTP/1.x, this closes the connection when the current request is inflight

When the request has not yet been sent, the request will be aborted and false is returned as indicator.

Overloads:

  • - (true, false) reset(code)

    Parameters:

    • code (Fixnum)
      the error code

Returns:

  • (true, false)
    true when reset has been performed


742
743
744
745
746
747
748
749
750
751
752
753
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 742

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

- (::Vertx::HttpClientResponse) result

The result of the operation. This will be null if the operation failed.

Returns:



197
198
199
200
201
202
203
204
205
206
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 197

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

- (self) sendHead - (self) sendHead(completionHandler) { ... }

Like #send_head but with an handler after headers have been sent. The handler will be called with the HttpVersion if it can be determined or null otherwise.

Overloads:

  • - (self) sendHead(completionHandler) { ... }

    Yields:

Returns:

  • (self)


405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 405

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

- (self) setChunked(chunked)

If chunked is true then the request will be set into HTTP chunked mode

Parameters:

  • chunked (true, false)
    true if chunked encoding

Returns:

  • (self)


595
596
597
598
599
600
601
602
603
604
605
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 595

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

- (self) setFollowRedirects(followRedirects)

Set the request to follow HTTP redirects up to => Object#get_max_redirects}.

Parameters:

  • followRedirects (true, false)
    true to follow HTTP redirects

Returns:

  • (self)


157
158
159
160
161
162
163
164
165
166
167
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 157

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

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

Yields:

Returns:

  • (self)


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 69

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

- (self) setHost(host)

Set the request host.

For HTTP/2 it sets the pseudo header otherwise it sets the header

Parameters:

  • host (String)

Returns:

  • (self)


540
541
542
543
544
545
546
547
548
549
550
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 540

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

- (self) setMaxRedirects(maxRedirects)

Set the max number of HTTP redirects this request will follow. The default is 0 which means no redirects.

Parameters:

  • maxRedirects (Fixnum)
    the number of HTTP redirect to follow

Returns:

  • (self)


224
225
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_client_request.rb', line 224

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

- (self) setRawMethod(method)

Set the value the method to send when the method is used.

Parameters:

  • method (String)
    the raw method

Returns:

  • (self)


388
389
390
391
392
393
394
395
396
397
398
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 388

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

- (self) setStreamPriority(streamPriority)

Sets the priority of the associated stream.

This is not implemented for HTTP/1.x.

Parameters:

  • streamPriority (Hash{String => Object})
    the priority of this request's stream

Returns:

  • (self)


718
719
720
721
722
723
724
725
726
727
728
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 718

def set_stream_priority(*args)
  if args[0].class == Hash && !block_given?
    @j_del.java_method(:setStreamPriority, [Java::IoVertxCoreHttp::StreamPriority.java_class]).call(Java::IoVertxCoreHttp::StreamPriority.new(::Vertx::Util::Utils.to_json_object(args[0])))
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling set_stream_priority(#{args[0]})"
  end
end

- (self) setTimeout(timeoutMs)

Set's the amount of time after which if the request does not return any data within the timeout period an TimeoutException will be passed to the exception handler (if provided) and the request will be closed.

Calling this method more than once has the effect of canceling any existing timeout and starting the timeout from scratch.

Parameters:

  • timeoutMs (Fixnum)
    The quantity of time in milliseconds.

Returns:

  • (self)


678
679
680
681
682
683
684
685
686
687
688
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 678

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

- (self) setWriteQueueMaxSize(maxSize)

Parameters:

  • maxSize (Fixnum)

Returns:

  • (self)


183
184
185
186
187
188
189
190
191
192
193
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 183

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

- (Fixnum) streamId

Returns the id of the stream of this response, when it is not yet determined, i.e the request has not been yet sent or it is not supported HTTP/1.x

Returns:

  • (Fixnum)
    the id of the stream of this response, when it is not yet determined, i.e the request has not been yet sent or it is not supported HTTP/1.x


88
89
90
91
92
93
94
95
96
97
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 88

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

- (String) uri

Returns The URI of the request.

Returns:

  • (String)
    The URI of the request.


608
609
610
611
612
613
614
615
616
617
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 608

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

- (void) write(data, handler) { ... } - (void) write(chunk, handler) { ... } - (void) write(chunk, enc, handler) { ... }

This method returns an undefined value.

Same as #write but with an handler called when the operation completes

Overloads:

  • - (void) write(data, handler) { ... }

    Parameters:

    Yields:

  • - (void) write(chunk, handler) { ... }

    Parameters:

    • chunk (String)

    Yields:

  • - (void) write(chunk, enc, handler) { ... }

    Parameters:

    • chunk (String)
    • enc (String)

    Yields:



453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 453

def write(*args)
  if args[0].class.method_defined?(:j_del) && true && args[1] == nil
    if (block_given?)
      return @j_del.java_method(:write, [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 ? nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:write, [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 ? nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  elsif args[0].class == String && true && args[1] == nil
    if (block_given?)
      return @j_del.java_method(:write, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:write, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(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
  elsif args[0].class == String && args[1].class == String && true
    if (block_given?)
      return @j_del.java_method(:write, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:write, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1],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 write(#{args[0]},#{args[1]})"
  end
end

- (self) writeCustomFrame(frame) - (self) writeCustomFrame(type, flags, payload)

Write an HTTP/2 frame to the request, allowing to extend the HTTP/2 protocol.

The frame is sent immediatly and is not subject to flow control.

This method must be called after the request headers have been sent and only for the protocol HTTP/2. The #send_head should be used for this purpose.

Overloads:

  • - (self) writeCustomFrame(frame)

    Parameters:

  • - (self) writeCustomFrame(type, flags, payload)

    Parameters:

    • type (Fixnum)
      the 8-bit frame type
    • flags (Fixnum)
      the 8-bit frame flags
    • payload (::Vertx::Buffer)
      the frame payload

Returns:

  • (self)


289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 289

def write_custom_frame(*args)
  if args[0].class.method_defined?(:j_del) && !block_given? && args[1] == nil && args[2] == nil
    @j_del.java_method(:writeCustomFrame, [Java::IoVertxCoreHttp::HttpFrame.java_class]).call(args[0].j_del)
    return self
  elsif args[0].class == Fixnum && args[1].class == Fixnum && args[2].class.method_defined?(:j_del) && !block_given?
    @j_del.java_method(:writeCustomFrame, [Java::int.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 write_custom_frame(#{args[0]},#{args[1]},#{args[2]})"
  end
end

- (true, false) writeQueueFull

This will return true if there are more bytes in the write queue than the value set using #set_write_queue_max_size

Returns:

  • (true, false)
    true if write queue is full


101
102
103
104
105
106
107
108
109
110
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 101

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