Class: Vertx::HttpClientRequest

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

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

Returns the absolute URI corresponding to the the HTTP request

Returns:

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

Raises:

  • (ArgumentError)


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

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

- (true, false) chunked?

Returns Is the request chunked?

Returns:

  • (true, false)
    Is the request chunked?

Raises:

  • (ArgumentError)


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 213

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

- (::Vertx::HttpConnection) connection

Returns the Vertx::HttpConnection associated with this request

Returns:

Raises:

  • (ArgumentError)


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

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
  raise ArgumentError, "Invalid arguments when calling connection()"
end

- (self) connection_handler { ... }

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

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

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

- (self) continue_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)

Raises:

  • (ArgumentError)


320
321
322
323
324
325
326
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 320

def continue_handler
  if block_given?
    @j_del.java_method(:continueHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling continue_handler()"
end

- (self) drain_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def drain_handler
  if block_given?
    @j_del.java_method(:drainHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling drain_handler()"
end

- (void) end - (void) end(chunk) - (void) end(chunk) - (void) end(chunk, enc)

This method returns an undefined value.

Same as #end but writes a String with the specified encoding

Overloads:

  • - (void) end(chunk)

    Parameters:

    • chunk (String)
  • - (void) end(chunk)

    Parameters:

  • - (void) end(chunk, enc)

    Parameters:

    • chunk (String)
    • enc (String)

Raises:

  • (ArgumentError)


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

def end(param_1=nil,param_2=nil)
  if !block_given? && param_1 == nil && param_2 == nil
    return @j_del.java_method(:end, []).call()
  elsif param_1.class == String && !block_given? && param_2 == nil
    return @j_del.java_method(:end, [Java::java.lang.String.java_class]).call(param_1)
  elsif param_1.class.method_defined?(:j_del) && !block_given? && param_2 == nil
    return @j_del.java_method(:end, [Java::IoVertxCoreBuffer::Buffer.java_class]).call(param_1.j_del)
  elsif param_1.class == String && param_2.class == String && !block_given?
    return @j_del.java_method(:end, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(param_1,param_2)
  end
  raise ArgumentError, "Invalid arguments when calling end(#{param_1},#{param_2})"
end

- (self) end_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def end_handler
  if block_given?
    @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling end_handler()"
end

- (self) exception_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def exception_handler
  if block_given?
    @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling exception_handler()"
end

- (self) fetch(amount = nil)

Parameters:

  • amount (Fixnum) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def fetch(amount=nil)
  if amount.class == Fixnum && !block_given?
    @j_del.java_method(:fetch, [Java::long.java_class]).call(amount)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling fetch(#{amount})"
end

- (String) get_host

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

Raises:

  • (ArgumentError)


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

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

- (String) get_raw_method

Returns the raw value of the method this request sends

Returns:

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

Raises:

  • (ArgumentError)


228
229
230
231
232
233
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 228

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

- (Hash) get_stream_priority

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

Returns:

  • (Hash)
    the priority of the associated HTTP/2 stream for HTTP/2 otherwise null

Raises:

  • (ArgumentError)


485
486
487
488
489
490
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 485

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
  raise ArgumentError, "Invalid arguments when calling get_stream_priority()"
end

- (self) handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def handler
  if block_given?
    @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::HttpClientResponse)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling handler()"
end

- (::Vertx::MultiMap) headers

Returns The HTTP headers

Returns:

Raises:

  • (ArgumentError)


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

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
  raise ArgumentError, "Invalid arguments when calling headers()"
end

- (:OPTIONS, ...) method

The HTTP method for the request.

Returns:

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

Raises:

  • (ArgumentError)


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

def method
  if !block_given?
    return @j_del.java_method(:method, []).call().name.intern
  end
  raise ArgumentError, "Invalid arguments when calling method()"
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

Raises:

  • (ArgumentError)


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 259

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

- (self) pause

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

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

- (::Vertx::Pipe) pipe

Pause this stream and return a to transfer the elements of this stream to a destination .

The stream will be resumed when the pipe will be wired to a WriteStream.

Returns:

Raises:

  • (ArgumentError)


78
79
80
81
82
83
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 78

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

- (void) pipe_to(dst = nil) { ... }

This method returns an undefined value.

Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

Parameters:

Yields:

Raises:

  • (ArgumentError)


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

def pipe_to(dst=nil)
  if dst.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class]).call(dst.j_del)
  elsif dst.class.method_defined?(:j_del) && block_given?
    return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(dst.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling pipe_to(#{dst})"
end

- (self) push_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 #handler method to set an handler to process the response.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


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 396

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

- (self) put_header(name = nil, value = nil)

Put an HTTP header

Parameters:

  • name (String) (defaults to: nil)
    The header name
  • value (String) (defaults to: nil)
    The header value

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def put_header(name=nil,value=nil)
  if name.class == String && value.class == String && !block_given?
    @j_del.java_method(:putHeader, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(name,value)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling put_header(#{name},#{value})"
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

Raises:

  • (ArgumentError)


266
267
268
269
270
271
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 266

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

- (true, false) reset?(code = nil)

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.

Parameters:

  • code (Fixnum) (defaults to: nil)
    the error code

Returns:

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

Raises:

  • (ArgumentError)


414
415
416
417
418
419
420
421
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 414

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

- (self) resume

Returns:

  • (self)

Raises:

  • (ArgumentError)


168
169
170
171
172
173
174
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 168

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

- (self) send_head { ... }

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)

Raises:

  • (ArgumentError)


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

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

- (self) set_chunked(chunked = nil)

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

Parameters:

  • chunked (true, false) (defaults to: nil)
    true if chunked encoding

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

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

- (self) set_follow_redirects(followRedirects = nil)

Parameters:

  • followRedirects (true, false) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

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

- (self) set_host(host = nil)

Set the request host.

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

Parameters:

  • host (String) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)


277
278
279
280
281
282
283
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 277

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

- (self) set_raw_method(method = nil)

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

Parameters:

  • method (String) (defaults to: nil)
    the raw method

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

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

- (self) set_stream_priority(streamPriority = nil)

Sets the priority of the associated stream.

This is not implemented for HTTP/1.x.

Parameters:

  • streamPriority (Hash) (defaults to: nil)
    the priority of this request's stream

Returns:

  • (self)

Raises:

  • (ArgumentError)


477
478
479
480
481
482
483
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 477

def set_stream_priority(streamPriority=nil)
  if streamPriority.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(streamPriority)))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_stream_priority(#{streamPriority})"
end

- (self) set_timeout(timeoutMs = nil)

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) (defaults to: nil)
    The quantity of time in milliseconds.

Returns:

  • (self)

Raises:

  • (ArgumentError)


371
372
373
374
375
376
377
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 371

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

- (self) set_write_queue_max_size(maxSize = nil)

Parameters:

  • maxSize (Fixnum) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)


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 134

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

- (Fixnum) stream_id

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

Raises:

  • (ArgumentError)


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

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

- (String) uri

Returns The URI of the request.

Returns:

  • (String)
    The URI of the request.

Raises:

  • (ArgumentError)


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

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

- (self) write(data) - (self) write(chunk) - (self) write(chunk, enc)

Write a String to the request body, encoded using the encoding enc.

Overloads:

  • - (self) write(data)

    Parameters:

  • - (self) write(chunk)

    Parameters:

    • chunk (String)
  • - (self) write(chunk, enc)

    Parameters:

    • chunk (String)
    • enc (String)

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def write(param_1=nil,param_2=nil)
  if param_1.class.method_defined?(:j_del) && !block_given? && param_2 == nil
    @j_del.java_method(:write, [Java::IoVertxCoreBuffer::Buffer.java_class]).call(param_1.j_del)
    return self
  elsif param_1.class == String && !block_given? && param_2 == nil
    @j_del.java_method(:write, [Java::java.lang.String.java_class]).call(param_1)
    return self
  elsif param_1.class == String && param_2.class == String && !block_given?
    @j_del.java_method(:write, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(param_1,param_2)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling write(#{param_1},#{param_2})"
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)

Raises:

  • (ArgumentError)


455
456
457
458
459
460
461
462
463
464
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 455

def write_custom_frame(param_1=nil,param_2=nil,param_3=nil)
  if param_1.class.method_defined?(:j_del) && !block_given? && param_2 == nil && param_3 == nil
    @j_del.java_method(:writeCustomFrame, [Java::IoVertxCoreHttp::HttpFrame.java_class]).call(param_1.j_del)
    return self
  elsif param_1.class == Fixnum && param_2.class == Fixnum && param_3.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(param_1,param_2,param_3.j_del)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling write_custom_frame(#{param_1},#{param_2},#{param_3})"
end

- (true, false) write_queue_full?

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

Raises:

  • (ArgumentError)


68
69
70
71
72
73
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/http_client_request.rb', line 68

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