Class: VertxWeb::LoggerHandler

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

Overview

A handler which logs request information to the Vert.x logger.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (::VertxWeb::LoggerHandler) create + (::VertxWeb::LoggerHandler) create(format) + (::VertxWeb::LoggerHandler) create(immediate, format)

Create a handler with he specified format

Overloads:

  • + (::VertxWeb::LoggerHandler) create(format)

    Parameters:

    • format (:DEFAULT, :SHORT, :TINY)
      the format
  • + (::VertxWeb::LoggerHandler) create(immediate, format)

    Parameters:

    • immediate (true, false)
      true if logging should occur as soon as request arrives
    • format (:DEFAULT, :SHORT, :TINY)
      the format

Returns:

Raises:

  • (ArgumentError)


50
51
52
53
54
55
56
57
58
59
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/logger_handler.rb', line 50

def self.create(param_1=nil,param_2=nil)
  if !block_given? && param_1 == nil && param_2 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::LoggerHandler.java_method(:create, []).call(),::VertxWeb::LoggerHandler)
  elsif param_1.class == Symbol && !block_given? && param_2 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::LoggerHandler.java_method(:create, [Java::IoVertxExtWebHandler::LoggerFormat.java_class]).call(Java::IoVertxExtWebHandler::LoggerFormat.valueOf(param_1.to_s)),::VertxWeb::LoggerHandler)
  elsif (param_1.class == TrueClass || param_1.class == FalseClass) && param_2.class == Symbol && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::LoggerHandler.java_method(:create, [Java::boolean.java_class,Java::IoVertxExtWebHandler::LoggerFormat.java_class]).call(param_1,Java::IoVertxExtWebHandler::LoggerFormat.valueOf(param_2.to_s)),::VertxWeb::LoggerHandler)
  end
  raise ArgumentError, "Invalid arguments when calling create(#{param_1},#{param_2})"
end

+ (Object) DEFAULT_FORMAT



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

def self.DEFAULT_FORMAT
  Java::IoVertxExtWebHandler::LoggerHandler.DEFAULT_FORMAT.name.intern
end

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

def @@j_api_type.wrap(obj)
  LoggerHandler.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)


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

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