Class List Method List File List

# Class: VertxWeb::ResponseTimeHandler

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

## Overview

Handler which adds a header `x-response-time` in the response of matching requests containing the time taken in ms to process the request.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxWeb::ResponseTimeHandler) create
  Create a handler.
- + (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/response_time_handler.rb', line 19

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

### + (`::VertxWeb::ResponseTimeHandler`) create

Create a handler

Returns:

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

Raises:

- (`ArgumentError`)

    45
    46
    47
    48
    49
    50
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/response_time_handler.rb', line 45

    def self.create
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::ResponseTimeHandler.java_method(:create, []).call(),::VertxWeb::ResponseTimeHandler)
      end
      raise ArgumentError, "Invalid arguments when calling create()"
    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/response_time_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/response_time_handler.rb', line 31

    def self.j_class
      Java::IoVertxExtWebHandler::ResponseTimeHandler.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/response_time_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/response_time_handler.rb', line 22

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