Class List Method List File List

# Class: Vertx::HttpServer

Inherits:
  Object
  - Object
  - Vertx::HttpServer
  show all
Includes:
  Measured
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb

## Instance Method Summary (collapse)

- - (Object) actual_port
- - (Object) close
- - (Object) connection_handler
- - (HttpServer) initialize(j_del) constructor
  A new instance of HttpServer.
- - (Object) j_del
- - (Object) listen(port = nil, host = nil)
- - (Boolean) metrics_enabled?
- - (Object) request_handler
- - (Object) request_stream
- - (Object) websocket_handler
- - (Object) websocket_stream

## Constructor Details

### - (`HttpServer`) initialize(j_del)

Returns a new instance of HttpServer

    21
    22
    23
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 21

    def initialize(j_del)
      @j_del = j_del
    end

## Instance Method Details

### - (`Object`) actual_port

Raises:

- (`ArgumentError`)

    135
    136
    137
    138
    139
    140
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 135

    def actual_port
      if !block_given?
        return @j_del.java_method(:actualPort, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling actual_port()"
    end

### - (`Object`) close

Raises:

- (`ArgumentError`)

    124
    125
    126
    127
    128
    129
    130
    131
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 124

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      elsif block_given?
        return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`Object`) connection_handler

Raises:

- (`ArgumentError`)

    63
    64
    65
    66
    67
    68
    69
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 63

    def connection_handler
      if block_given?
        @j_del.java_method(:connectionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::HttpConnection)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling connection_handler()"
    end

### - (`Object`) j_del

    26
    27
    28
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 26

    def j_del
      @j_del
    end

### - (`Object`) listen(port = nil, host = nil)

Raises:

- (`ArgumentError`)

    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 99

    def listen(port=nil,host=nil)
      if !block_given? && port == nil && host == nil
        @j_del.java_method(:listen, []).call()
        return self
      elsif port.class == Fixnum && !block_given? && host == nil
        @j_del.java_method(:listen, [Java::int.java_class]).call(port)
        return self
      elsif block_given? && port == nil && host == nil
        @j_del.java_method(:listen, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::HttpServer) : nil) }))
        return self
      elsif port.class == Fixnum && host.class == String && !block_given?
        @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class]).call(port,host)
        return self
      elsif port.class == Fixnum && block_given? && host == nil
        @j_del.java_method(:listen, [Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(port,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::HttpServer) : nil) }))
        return self
      elsif port.class == Fixnum && host.class == String && block_given?
        @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(port,host,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::HttpServer) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling listen(port,host)"
    end

### - (`Boolean`) metrics_enabled?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    31
    32
    33
    34
    35
    36
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 31

    def metrics_enabled?
      if !block_given?
        return @j_del.java_method(:isMetricsEnabled, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling metrics_enabled?()"
    end

### - (`Object`) request_handler

Raises:

- (`ArgumentError`)

    53
    54
    55
    56
    57
    58
    59
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 53

    def request_handler
      if block_given?
        @j_del.java_method(:requestHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::HttpServerRequest)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling request_handler()"
    end

### - (`Object`) request_stream

Raises:

- (`ArgumentError`)

    40
    41
    42
    43
    44
    45
    46
    47
    48
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 40

    def request_stream
      if !block_given?
        if @cached_request_stream != nil
          return @cached_request_stream
        end
        return @cached_request_stream = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:requestStream, []).call(),::Vertx::HttpServerRequestStream)
      end
      raise ArgumentError, "Invalid arguments when calling request_stream()"
    end

### - (`Object`) websocket_handler

Raises:

- (`ArgumentError`)

    86
    87
    88
    89
    90
    91
    92
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 86

    def websocket_handler
      if block_given?
        @j_del.java_method(:websocketHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::ServerWebSocket)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling websocket_handler()"
    end

### - (`Object`) websocket_stream

Raises:

- (`ArgumentError`)

    73
    74
    75
    76
    77
    78
    79
    80
    81
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/http_server.rb', line 73

    def websocket_stream
      if !block_given?
        if @cached_websocket_stream != nil
          return @cached_websocket_stream
        end
        return @cached_websocket_stream = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:websocketStream, []).call(),::Vertx::ServerWebSocketStream)
      end
      raise ArgumentError, "Invalid arguments when calling websocket_stream()"
    end