Class List Method List File List

# Class: VertxWeb::Router

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

## Overview

A router receives request from an Vertx::HttpServer and routes it to the first matching Route that it contains. A router can contain many routes.

Routers are also used for routing failures.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (::VertxWeb::Router) router(vertx = nil)
  Create a router.
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) accept(request = nil)
  This method is used to provide a request to the router.
- - (self) clear
  Remove all the routes from this router.
- - (::VertxWeb::Route) connect(path = nil)
  Add a route that matches a HTTP CONNECT request and the specified path.
- - (::VertxWeb::Route) connect_with_regex(regex = nil)
  Add a route that matches a HTTP CONNECT request and the specified path regex.
- - (::VertxWeb::Route) delete(path = nil)
  Add a route that matches a HTTP DELETE request and the specified path.
- - (::VertxWeb::Route) delete_with_regex(regex = nil)
  Add a route that matches a HTTP DELETE request and the specified path regex.
- - (self) exception_handler { ... }
  Specify a handler for any unhandled exceptions on this router.
- - (::VertxWeb::Route) get(path = nil)
  Add a route that matches a HTTP GET request and the specified path.
- - (Array<::VertxWeb::Route>) get_routes
  A list of all the routes on this router.
- - (::VertxWeb::Route) get_with_regex(regex = nil)
  Add a route that matches a HTTP GET request and the specified path regex.
- - (void) handle(event = nil)
  Something has happened, so handle it.
- - (void) handle_context(context = nil)
  Used to route a context to the router.
- - (void) handle_failure(context = nil)
  Used to route a failure to the router.
- - (::VertxWeb::Route) head(path = nil)
  Add a route that matches a HTTP HEAD request and the specified path.
- - (::VertxWeb::Route) head_with_regex(regex = nil)
  Add a route that matches a HTTP HEAD request and the specified path regex.
- - (self) mount_sub_router(mountPoint = nil, subRouter = nil)
  Mount a sub router on this router.
- - (::VertxWeb::Route) options(path = nil)
  Add a route that matches a HTTP OPTIONS request and the specified path.
- - (::VertxWeb::Route) options_with_regex(regex = nil)
  Add a route that matches a HTTP OPTIONS request and the specified path regex.
- - (::VertxWeb::Route) patch(path = nil)
  Add a route that matches a HTTP PATCH request and the specified path.
- - (::VertxWeb::Route) patch_with_regex(regex = nil)
  Add a route that matches a HTTP PATCH request and the specified path regex.
- - (::VertxWeb::Route) post(path = nil)
  Add a route that matches a HTTP POST request and the specified path.
- - (::VertxWeb::Route) post_with_regex(regex = nil)
  Add a route that matches a HTTP POST request and the specified path regex.
- - (::VertxWeb::Route) put(path = nil)
  Add a route that matches a HTTP PUT request and the specified path.
- - (::VertxWeb::Route) put_with_regex(regex = nil)
  Add a route that matches a HTTP PUT request and the specified path regex.
- - (::VertxWeb::Route) route(param_1 = nil, param_2 = nil)
  Add a route that matches the specified HTTP method and path.
- - (::VertxWeb::Route) route_with_regex(param_1 = nil, param_2 = nil)
  Add a route that matches the specified HTTP method and path regex.
- - (::VertxWeb::Route) trace(path = nil)
  Add a route that matches a HTTP TRACE request and the specified path.
- - (::VertxWeb::Route) trace_with_regex(regex = nil)
  Add a route that matches a HTTP TRACE request and the specified path regex.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

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

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

### + (`Object`) j_api_type

    33
    34
    35
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 33

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

    def self.j_class
      Java::IoVertxExtWeb::Router.java_class
    end

### + (`::VertxWeb::Router`) router(vertx = nil)

Create a router

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the Vert.x instance

Returns:

- (`::VertxWeb::Router`) —
  the router

Raises:

- (`ArgumentError`)

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

    def self.router(vertx=nil)
      if vertx.class.method_defined?(:j_del) && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWeb::Router.java_method(:router, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxWeb::Router)
      end
      raise ArgumentError, "Invalid arguments when calling router(#{vertx})"
    end

### + (`Object`) unwrap(obj)

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

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

### + (`Object`) wrap(obj)

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

    def @@j_api_type.wrap(obj)
      Router.new(obj)
    end

## Instance Method Details

### - (`void`) accept(request = nil)

This method returns an undefined value.

This method is used to provide a request to the router. Usually you take request from the Vertx::HttpServer#request_handler and pass it to this method. The router then routes it to matching routes. This method is now deprecated you can use this object directly as a request handler, which means there is no need for a method reference anymore.

Parameters:

- request (`::Vertx::HttpServerRequest`) (defaults to: `nil`) —
  the request

Raises:

- (`ArgumentError`)

    65
    66
    67
    68
    69
    70
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 65

    def accept(request=nil)
      if request.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:accept, [Java::IoVertxCoreHttp::HttpServerRequest.java_class]).call(request.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling accept(#{request})"
    end

### - (`self`) clear

Remove all the routes from this router

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    293
    294
    295
    296
    297
    298
    299
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 293

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

### - (`::VertxWeb::Route`) connect(path = nil)

Add a route that matches a HTTP CONNECT request and the specified path

Parameters:

- path (`String`) (defaults to: `nil`) —
  URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    247
    248
    249
    250
    251
    252
    253
    254
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 247

    def connect(path=nil)
      if !block_given? && path == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:connect, []).call(),::VertxWeb::Route)
      elsif path.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:connect, [Java::java.lang.String.java_class]).call(path),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling connect(#{path})"
    end

### - (`::VertxWeb::Route`) connect_with_regex(regex = nil)

Add a route that matches a HTTP CONNECT request and the specified path regex

Parameters:

- regex (`String`) (defaults to: `nil`) —
  URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    258
    259
    260
    261
    262
    263
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 258

    def connect_with_regex(regex=nil)
      if regex.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:connectWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling connect_with_regex(#{regex})"
    end

### - (`::VertxWeb::Route`) delete(path = nil)

Add a route that matches a HTTP DELETE request and the specified path

Parameters:

- path (`String`) (defaults to: `nil`) —
  URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    207
    208
    209
    210
    211
    212
    213
    214
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 207

    def delete(path=nil)
      if !block_given? && path == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:delete, []).call(),::VertxWeb::Route)
      elsif path.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:delete, [Java::java.lang.String.java_class]).call(path),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling delete(#{path})"
    end

### - (`::VertxWeb::Route`) delete_with_regex(regex = nil)

Add a route that matches a HTTP DELETE request and the specified path regex

Parameters:

- regex (`String`) (defaults to: `nil`) —
  URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    218
    219
    220
    221
    222
    223
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 218

    def delete_with_regex(regex=nil)
      if regex.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:deleteWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling delete_with_regex(#{regex})"
    end

### - (`self`) exception_handler { ... }

Specify a handler for any unhandled exceptions on this router. The handler will be called for exceptions thrown from handlers. This does not affect the normal failure routing logic.

Yields:

- the exception handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    315
    316
    317
    318
    319
    320
    321
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 315

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

### - (`::VertxWeb::Route`) get(path = nil)

Add a route that matches a HTTP GET request and the specified path

Parameters:

- path (`String`) (defaults to: `nil`) —
  URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    107
    108
    109
    110
    111
    112
    113
    114
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 107

    def get(path=nil)
      if !block_given? && path == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:get, []).call(),::VertxWeb::Route)
      elsif path.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:get, [Java::java.lang.String.java_class]).call(path),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling get(#{path})"
    end

### - (`Array<::VertxWeb::Route>`) get_routes

Returns a list of all the routes on this router

Returns:

- (`Array<::VertxWeb::Route>`) —
  a list of all the routes on this router

Raises:

- (`ArgumentError`)

    285
    286
    287
    288
    289
    290
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 285

    def get_routes
      if !block_given?
        return @j_del.java_method(:getRoutes, []).call().to_a.map { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxWeb::Route) }
      end
      raise ArgumentError, "Invalid arguments when calling get_routes()"
    end

### - (`::VertxWeb::Route`) get_with_regex(regex = nil)

Add a route that matches a HTTP GET request and the specified path regex

Parameters:

- regex (`String`) (defaults to: `nil`) —
  URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    118
    119
    120
    121
    122
    123
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 118

    def get_with_regex(regex=nil)
      if regex.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling get_with_regex(#{regex})"
    end

### - (`void`) handle(event = nil)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:

- event (`::Vertx::HttpServerRequest`) (defaults to: `nil`) —
  the event to handle

Raises:

- (`ArgumentError`)

    42
    43
    44
    45
    46
    47
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 42

    def handle(event=nil)
      if event.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:handle, [Java::IoVertxCoreHttp::HttpServerRequest.java_class]).call(event.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling handle(#{event})"
    end

### - (`void`) handle_context(context = nil)

This method returns an undefined value.

Used to route a context to the router. Used for sub-routers. You wouldn't normally call this method directly.

Parameters:

- context (`::VertxWeb::RoutingContext`) (defaults to: `nil`) —
  the routing context

Raises:

- (`ArgumentError`)

    325
    326
    327
    328
    329
    330
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 325

    def handle_context(context=nil)
      if context.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:handleContext, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(context.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling handle_context(#{context})"
    end

### - (`void`) handle_failure(context = nil)

This method returns an undefined value.

Used to route a failure to the router. Used for sub-routers. You wouldn't normally call this method directly.

Parameters:

- context (`::VertxWeb::RoutingContext`) (defaults to: `nil`) —
  the routing context

Raises:

- (`ArgumentError`)

    334
    335
    336
    337
    338
    339
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 334

    def handle_failure(context=nil)
      if context.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:handleFailure, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(context.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling handle_failure(#{context})"
    end

### - (`::VertxWeb::Route`) head(path = nil)

Add a route that matches a HTTP HEAD request and the specified path

Parameters:

- path (`String`) (defaults to: `nil`) —
  URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    127
    128
    129
    130
    131
    132
    133
    134
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 127

    def head(path=nil)
      if !block_given? && path == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:head, []).call(),::VertxWeb::Route)
      elsif path.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:head, [Java::java.lang.String.java_class]).call(path),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling head(#{path})"
    end

### - (`::VertxWeb::Route`) head_with_regex(regex = nil)

Add a route that matches a HTTP HEAD request and the specified path regex

Parameters:

- regex (`String`) (defaults to: `nil`) —
  URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    138
    139
    140
    141
    142
    143
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 138

    def head_with_regex(regex=nil)
      if regex.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:headWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling head_with_regex(#{regex})"
    end

### - (`self`) mount_sub_router(mountPoint = nil, subRouter = nil)

Mount a sub router on this router

Parameters:

- mountPoint (`String`) (defaults to: `nil`) —
  the mount point (path prefix) to mount it on
- subRouter (`::VertxWeb::Router`) (defaults to: `nil`) —
  the router to mount as a sub router

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    304
    305
    306
    307
    308
    309
    310
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 304

    def mount_sub_router(mountPoint=nil,subRouter=nil)
      if mountPoint.class == String && subRouter.class.method_defined?(:j_del) && !block_given?
        @j_del.java_method(:mountSubRouter, [Java::java.lang.String.java_class,Java::IoVertxExtWeb::Router.java_class]).call(mountPoint,subRouter.j_del)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling mount_sub_router(#{mountPoint},#{subRouter})"
    end

### - (`::VertxWeb::Route`) options(path = nil)

Add a route that matches a HTTP OPTIONS request and the specified path

Parameters:

- path (`String`) (defaults to: `nil`) —
  URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    147
    148
    149
    150
    151
    152
    153
    154
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 147

    def options(path=nil)
      if !block_given? && path == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:options, []).call(),::VertxWeb::Route)
      elsif path.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:options, [Java::java.lang.String.java_class]).call(path),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling options(#{path})"
    end

### - (`::VertxWeb::Route`) options_with_regex(regex = nil)

Add a route that matches a HTTP OPTIONS request and the specified path regex

Parameters:

- regex (`String`) (defaults to: `nil`) —
  URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    158
    159
    160
    161
    162
    163
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 158

    def options_with_regex(regex=nil)
      if regex.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:optionsWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling options_with_regex(#{regex})"
    end

### - (`::VertxWeb::Route`) patch(path = nil)

Add a route that matches a HTTP PATCH request and the specified path

Parameters:

- path (`String`) (defaults to: `nil`) —
  URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    267
    268
    269
    270
    271
    272
    273
    274
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 267

    def patch(path=nil)
      if !block_given? && path == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:patch, []).call(),::VertxWeb::Route)
      elsif path.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:patch, [Java::java.lang.String.java_class]).call(path),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling patch(#{path})"
    end

### - (`::VertxWeb::Route`) patch_with_regex(regex = nil)

Add a route that matches a HTTP PATCH request and the specified path regex

Parameters:

- regex (`String`) (defaults to: `nil`) —
  URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    278
    279
    280
    281
    282
    283
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 278

    def patch_with_regex(regex=nil)
      if regex.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:patchWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling patch_with_regex(#{regex})"
    end

### - (`::VertxWeb::Route`) post(path = nil)

Add a route that matches a HTTP POST request and the specified path

Parameters:

- path (`String`) (defaults to: `nil`) —
  URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    187
    188
    189
    190
    191
    192
    193
    194
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 187

    def post(path=nil)
      if !block_given? && path == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:post, []).call(),::VertxWeb::Route)
      elsif path.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:post, [Java::java.lang.String.java_class]).call(path),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling post(#{path})"
    end

### - (`::VertxWeb::Route`) post_with_regex(regex = nil)

Add a route that matches a HTTP POST request and the specified path regex

Parameters:

- regex (`String`) (defaults to: `nil`) —
  URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    198
    199
    200
    201
    202
    203
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 198

    def post_with_regex(regex=nil)
      if regex.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:postWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling post_with_regex(#{regex})"
    end

### - (`::VertxWeb::Route`) put(path = nil)

Add a route that matches a HTTP PUT request and the specified path

Parameters:

- path (`String`) (defaults to: `nil`) —
  URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    167
    168
    169
    170
    171
    172
    173
    174
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 167

    def put(path=nil)
      if !block_given? && path == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:put, []).call(),::VertxWeb::Route)
      elsif path.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:put, [Java::java.lang.String.java_class]).call(path),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling put(#{path})"
    end

### - (`::VertxWeb::Route`) put_with_regex(regex = nil)

Add a route that matches a HTTP PUT request and the specified path regex

Parameters:

- regex (`String`) (defaults to: `nil`) —
  URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    178
    179
    180
    181
    182
    183
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 178

    def put_with_regex(regex=nil)
      if regex.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:putWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling put_with_regex(#{regex})"
    end

### - (`::VertxWeb::Route`) route - (`::VertxWeb::Route`) route(path) - (`::VertxWeb::Route`) route(method, path)

Add a route that matches the specified HTTP method and path

Overloads:

- - (`::VertxWeb::Route`) route(path)

  Parameters:

  - path (`String`) —
    URI paths that begin with this path will match
- - (`::VertxWeb::Route`) route(method, path)

  Parameters:

  - method (`:OPTIONS`, `:GET`, `:HEAD`, `:POST`, `:PUT`, `:DELETE`, `:TRACE`, `:CONNECT`, `:PATCH`, `:OTHER`) —
    the HTTP method to match
  - path (`String`) —
    URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 79

    def route(param_1=nil,param_2=nil)
      if !block_given? && param_1 == nil && param_2 == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:route, []).call(),::VertxWeb::Route)
      elsif param_1.class == String && !block_given? && param_2 == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:route, [Java::java.lang.String.java_class]).call(param_1),::VertxWeb::Route)
      elsif param_1.class == Symbol && param_2.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:route, [Java::IoVertxCoreHttp::HttpMethod.java_class,Java::java.lang.String.java_class]).call(Java::IoVertxCoreHttp::HttpMethod.valueOf(param_1.to_s),param_2),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling route(#{param_1},#{param_2})"
    end

### - (`::VertxWeb::Route`) routeWithRegex(regex) - (`::VertxWeb::Route`) routeWithRegex(method, regex)

Add a route that matches the specified HTTP method and path regex

Overloads:

- - (`::VertxWeb::Route`) routeWithRegex(regex)

  Parameters:

  - regex (`String`) —
    URI paths that begin with a match for this regex will match
- - (`::VertxWeb::Route`) routeWithRegex(method, regex)

  Parameters:

  - method (`:OPTIONS`, `:GET`, `:HEAD`, `:POST`, `:PUT`, `:DELETE`, `:TRACE`, `:CONNECT`, `:PATCH`, `:OTHER`) —
    the HTTP method to match
  - regex (`String`) —
    URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    96
    97
    98
    99
    100
    101
    102
    103
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 96

    def route_with_regex(param_1=nil,param_2=nil)
      if param_1.class == String && !block_given? && param_2 == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:routeWithRegex, [Java::java.lang.String.java_class]).call(param_1),::VertxWeb::Route)
      elsif param_1.class == Symbol && param_2.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:routeWithRegex, [Java::IoVertxCoreHttp::HttpMethod.java_class,Java::java.lang.String.java_class]).call(Java::IoVertxCoreHttp::HttpMethod.valueOf(param_1.to_s),param_2),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling route_with_regex(#{param_1},#{param_2})"
    end

### - (`::VertxWeb::Route`) trace(path = nil)

Add a route that matches a HTTP TRACE request and the specified path

Parameters:

- path (`String`) (defaults to: `nil`) —
  URI paths that begin with this path will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    227
    228
    229
    230
    231
    232
    233
    234
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 227

    def trace(path=nil)
      if !block_given? && path == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:trace, []).call(),::VertxWeb::Route)
      elsif path.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:trace, [Java::java.lang.String.java_class]).call(path),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling trace(#{path})"
    end

### - (`::VertxWeb::Route`) trace_with_regex(regex = nil)

Add a route that matches a HTTP TRACE request and the specified path regex

Parameters:

- regex (`String`) (defaults to: `nil`) —
  URI paths that begin with a match for this regex will match

Returns:

- (`::VertxWeb::Route`) —
  the route

Raises:

- (`ArgumentError`)

    238
    239
    240
    241
    242
    243
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 238

    def trace_with_regex(regex=nil)
      if regex.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:traceWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)
      end
      raise ArgumentError, "Invalid arguments when calling trace_with_regex(#{regex})"
    end