Class: VertxWeb::TimeoutHandler

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/timeout_handler.rb

Overview

Handler that will timeout requests if the response has not been written after a certain time. Timeout requests will be ended with an HTTP status code `503`.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


19
20
21
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/timeout_handler.rb', line 19

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

+ (::VertxWeb::TimeoutHandler) create(timeout = nil, errorCode = nil)

Create a handler

Parameters:

  • timeout (Fixnum) (defaults to: nil)
    the timeout, in ms
  • errorCode (Fixnum) (defaults to: nil)

Returns:

Raises:

  • (ArgumentError)


47
48
49
50
51
52
53
54
55
56
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/timeout_handler.rb', line 47

def self.create(timeout=nil,errorCode=nil)
  if !block_given? && timeout == nil && errorCode == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::TimeoutHandler.java_method(:create, []).call(),::VertxWeb::TimeoutHandler)
  elsif timeout.class == Fixnum && !block_given? && errorCode == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::TimeoutHandler.java_method(:create, [Java::long.java_class]).call(timeout),::VertxWeb::TimeoutHandler)
  elsif timeout.class == Fixnum && errorCode.class == Fixnum && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::TimeoutHandler.java_method(:create, [Java::long.java_class,Java::int.java_class]).call(timeout,errorCode),::VertxWeb::TimeoutHandler)
  end
  raise ArgumentError, "Invalid arguments when calling create(#{timeout},#{errorCode})"
end

+ (Object) DEFAULT_ERRORCODE

The default error code


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

def self.DEFAULT_ERRORCODE
  Java::IoVertxExtWebHandler::TimeoutHandler.DEFAULT_ERRORCODE
end

+ (Object) DEFAULT_TIMEOUT

The default timeout, in ms


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

def self.DEFAULT_TIMEOUT
  Java::IoVertxExtWebHandler::TimeoutHandler.DEFAULT_TIMEOUT
end

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

def self.j_class
  Java::IoVertxExtWebHandler::TimeoutHandler.java_class
end

+ (Object) unwrap(obj)



25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/timeout_handler.rb', line 25

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

+ (Object) wrap(obj)



22
23
24
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/timeout_handler.rb', line 22

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

Instance Method Details

- (void) handle(event = nil)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:

Raises:

  • (ArgumentError)


37
38
39
40
41
42
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/timeout_handler.rb', line 37

def handle(event=nil)
  if event.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(event.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling handle(#{event})"
end