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?, #context, #failed?, failed_future, future, #map_empty, #succeeded?, succeeded_future

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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


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

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?


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

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) { ... } - (::Vertx::Future) compose(successMapper, failureMapper) { ... }

Compose this future with a successMapper and failureMapper functions.

When this future (the one on which compose is called) succeeds, the successMapper 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.

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

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

Overloads:

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

    Yields:

    • the mapper function
  • - (::Vertx::Future) compose(successMapper, failureMapper) { ... }

    Parameters:

    • successMapper (Proc)
      the function mapping the success

    Yields:

    • the function mapping the failure

Returns:



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

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

- (::Vertx::HttpConnection) connection

Returns the Vertx::HttpConnection associated with this request

Returns:



336
337
338
339
340
341
342
343
344
345
346
347
348
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 336

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) 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)


701
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 701

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)


296
297
298
299
300
301
302
303
304
305
306
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 296

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:



363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 363

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)


848
849
850
851
852
853
854
855
856
857
858
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 848

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

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

Alias for Future#compose.

Yields:

Returns:



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

def flat_map(*args)
  if block_given? && args[0] == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:flatMap, [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 flat_map(#{args[0]})"
  end
end

- (Proc) getHandler

Returns the handler for the result

Returns:

  • (Proc)
    the handler for the result


187
188
189
190
191
192
193
194
195
196
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 187

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


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

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


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

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


728
729
730
731
732
733
734
735
736
737
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 728

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:



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

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:



464
465
466
467
468
469
470
471
472
473
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 464

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)


602
603
604
605
606
607
608
609
610
611
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 602

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

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

Get a for the underlying connection of this request.

The handler is called after the response headers are received.

This shall be used when using a method.

HTTP/1.1 pipe-lined requests cannot support net socket upgrade.

Pooled connection is removed from the pool.

Yields:

  • the handler

Returns:

  • (self)


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

def net_socket
  if true
    if (block_given?)
      @j_del.java_method(:netSocket, [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::NetSocket) : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:netSocket, [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::NetSocket) : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::NetSocket.j_api_type)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling net_socket()"
  end
end

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

Add a handler to be notified of the result.

Yields:

  • the handler that will be called with the result

Returns:

  • (self)


629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 629

def on_complete
  if true
    if (block_given?)
      @j_del.java_method(:onComplete, [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(:onComplete, [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 on_complete()"
  end
end

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

Add a handler to be notified of the failed result.

Yields:

  • the handler that will be called with the failed result

Returns:

  • (self)


117
118
119
120
121
122
123
124
125
126
127
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 117

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

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

Add a handler to be notified of the succeeded result.

Yields:

  • the handler that will be called with the succeeded result

Returns:

  • (self)


864
865
866
867
868
869
870
871
872
873
874
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 864

def on_success
  if true
    @j_del.java_method(:onSuccess, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::HttpClientResponse)) unless !block_given? }))
    return self
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling on_success()"
  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:



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

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:



682
683
684
685
686
687
688
689
690
691
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 682

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


255
256
257
258
259
260
261
262
263
264
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 255

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)


147
148
149
150
151
152
153
154
155
156
157
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 147

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)


834
835
836
837
838
839
840
841
842
843
844
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 834

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


614
615
616
617
618
619
620
621
622
623
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 614

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:



589
590
591
592
593
594
595
596
597
598
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 589

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


817
818
819
820
821
822
823
824
825
826
827
828
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 817

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:



243
244
245
246
247
248
249
250
251
252
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 243

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(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.

Yields:

Returns:

  • (self)


435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 435

def send_head
  if true
    if (block_given?)
      @j_del.java_method(:sendHead, [Java::IoVertxCore::Handler.java_class]).call(nil)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:sendHead, [Java::IoVertxCore::Handler.java_class]).call(nil)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::Vertx::Util::java_enum_type(Java::IoVertxCoreHttp::HttpVersion))
    end
  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)


650
651
652
653
654
655
656
657
658
659
660
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 650

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)


174
175
176
177
178
179
180
181
182
183
184
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 174

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)


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

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)


573
574
575
576
577
578
579
580
581
582
583
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 573

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)


270
271
272
273
274
275
276
277
278
279
280
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 270

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)


419
420
421
422
423
424
425
426
427
428
429
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 419

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)


793
794
795
796
797
798
799
800
801
802
803
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 793

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)


747
748
749
750
751
752
753
754
755
756
757
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 747

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)


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

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


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

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.


663
664
665
666
667
668
669
670
671
672
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 663

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:



486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 486

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)


320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 320

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


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

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