Class List Method List File List

# Class: VertxWeb::Router

Inherits:
  Object
  - Object
  - VertxWeb::Router
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/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`)

    26
    27
    28
    29
    30
    31
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 26

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

    37
    38
    39
    40
    41
    42
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 37

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

    266
    267
    268
    269
    270
    271
    272
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 266

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

    219
    220
    221
    222
    223
    224
    225
    226
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 219

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

    230
    231
    232
    233
    234
    235
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 230

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

    179
    180
    181
    182
    183
    184
    185
    186
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 179

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

    190
    191
    192
    193
    194
    195
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 190

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

    288
    289
    290
    291
    292
    293
    294
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 288

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

    79
    80
    81
    82
    83
    84
    85
    86
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 79

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

    258
    259
    260
    261
    262
    263
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 258

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

    90
    91
    92
    93
    94
    95
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 90

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

    298
    299
    300
    301
    302
    303
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 298

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

    307
    308
    309
    310
    311
    312
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 307

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

    99
    100
    101
    102
    103
    104
    105
    106
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 99

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

    110
    111
    112
    113
    114
    115
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 110

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

    277
    278
    279
    280
    281
    282
    283
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 277

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

    119
    120
    121
    122
    123
    124
    125
    126
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 119

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

    130
    131
    132
    133
    134
    135
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 130

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

    239
    240
    241
    242
    243
    244
    245
    246
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 239

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

    250
    251
    252
    253
    254
    255
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 250

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

    159
    160
    161
    162
    163
    164
    165
    166
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 159

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

    170
    171
    172
    173
    174
    175
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 170

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

    139
    140
    141
    142
    143
    144
    145
    146
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 139

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

    150
    151
    152
    153
    154
    155
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 150

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

    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 51

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

    68
    69
    70
    71
    72
    73
    74
    75
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 68

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

    199
    200
    201
    202
    203
    204
    205
    206
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 199

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

    210
    211
    212
    213
    214
    215
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/router.rb', line 210

    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