Class List Method List File List

# Class: VertxWeb::VirtualHostHandler

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

## Overview

Handler that will filter requests based on the request Host name.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxWeb::VirtualHostHandler) create(hostname = nil) { ... }
  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`)

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

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

### + (`::VertxWeb::VirtualHostHandler`) create(hostname = nil) { ... }

Create a handler

Parameters:

- hostname (`String`) (defaults to: `nil`)

Yields:

Returns:

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

Raises:

- (`ArgumentError`)

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

    def self.create(hostname=nil)
      if hostname.class == String && block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::VirtualHostHandler.java_method(:create, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(hostname,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::RoutingContext)) })),::VertxWeb::VirtualHostHandler)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{hostname})"
    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/virtual_host_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/virtual_host_handler.rb', line 30

    def self.j_class
      Java::IoVertxExtWebHandler::VirtualHostHandler.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/virtual_host_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/virtual_host_handler.rb', line 21

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

    36
    37
    38
    39
    40
    41
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/virtual_host_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