Class List Method List File List

# Class: VertxWeb::LoggerHandler

Inherits:
  Object
  - Object
  - VertxWeb::LoggerHandler
  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. You should mount this handler before any handler that could fail the routing context

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxWeb::LoggerHandler) create(param_1 = nil, param_2 = nil)
  Create a handler with he specified format.
- + (Object) DEFAULT_FORMAT
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) handle(event = nil)
  Something has happened, so handle it.

## 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/logger_handler.rb', line 19

    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:

- (`::VertxWeb::LoggerHandler`) —
  the handler

Raises:

- (`ArgumentError`)

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

    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

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

    def self.DEFAULT_FORMAT
      Java::IoVertxExtWebHandler::LoggerHandler.DEFAULT_FORMAT.name.intern
    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/logger_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/logger_handler.rb', line 31

    def self.j_class
      Java::IoVertxExtWebHandler::LoggerHandler.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/logger_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/logger_handler.rb', line 22

    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:

- event (`::VertxWeb::RoutingContext`) (defaults to: `nil`) —
  the event to handle

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/logger_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