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-web/src/main/resources/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.

## Class Method Summary (collapse)

- + (::VertxWeb::Router) router(vertx = nil)
  Create a router.

## 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
  @return 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_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

### + (`::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`)

    25
    26
    27
    28
    29
    30
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 25

    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

## 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.

Parameters:

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

Raises:

- (`ArgumentError`)

    36
    37
    38
    39
    40
    41
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 36

    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`)

    265
    266
    267
    268
    269
    270
    271
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 265

    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`)

    218
    219
    220
    221
    222
    223
    224
    225
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 218

    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`)

    229
    230
    231
    232
    233
    234
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 229

    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`)

    178
    179
    180
    181
    182
    183
    184
    185
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 178

    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`)

    189
    190
    191
    192
    193
    194
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 189

    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`)

    287
    288
    289
    290
    291
    292
    293
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 287

    def exception_handler
      if block_given?
        @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(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`)

    78
    79
    80
    81
    82
    83
    84
    85
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 78

    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

@return a list of all the routes on this router

Returns:

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

Raises:

- (`ArgumentError`)

    257
    258
    259
    260
    261
    262
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 257

    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`)

    89
    90
    91
    92
    93
    94
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 89

    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_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`)

    297
    298
    299
    300
    301
    302
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 297

    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`)

    306
    307
    308
    309
    310
    311
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 306

    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`)

    98
    99
    100
    101
    102
    103
    104
    105
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 98

    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`)

    109
    110
    111
    112
    113
    114
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 109

    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`)

    276
    277
    278
    279
    280
    281
    282
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 276

    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`)

    118
    119
    120
    121
    122
    123
    124
    125
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 118

    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`)

    129
    130
    131
    132
    133
    134
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 129

    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`)

    238
    239
    240
    241
    242
    243
    244
    245
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 238

    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`)

    249
    250
    251
    252
    253
    254
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 249

    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`)

    158
    159
    160
    161
    162
    163
    164
    165
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 158

    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`)

    169
    170
    171
    172
    173
    174
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 169

    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`)

    138
    139
    140
    141
    142
    143
    144
    145
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 138

    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`)

    149
    150
    151
    152
    153
    154
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 149

    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`) —
    the HTTP method to match
  - path (`String`) —
    URI paths that begin with this path will match

Returns:

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

Raises:

- (`ArgumentError`)

    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 50

    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),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`) —
    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`)

    67
    68
    69
    70
    71
    72
    73
    74
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 67

    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),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`)

    198
    199
    200
    201
    202
    203
    204
    205
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 198

    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`)

    209
    210
    211
    212
    213
    214
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/router.rb', line 209

    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