Class: VertxWeb::Router

Inherits:
Object
  • Object
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)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (::VertxWeb::Router) router(vertx)

Create a router

Parameters:

Returns:



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

def self.router(*args)
  if args[0].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(args[0].j_del),::VertxWeb::Router)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling router(#{args[0]})"
  end
end

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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

Instance Method Details

- (void) accept(request)

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:



349
350
351
352
353
354
355
356
357
358
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 349

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

- (self) clear

Remove all the routes from this router

Returns:

  • (self)


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

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

- (::VertxWeb::Route) connect - (::VertxWeb::Route) connect(path)

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

Overloads:

  • - (::VertxWeb::Route) connect(path)

    Parameters:

    • path (String)
      URI paths that begin with this path will match

Returns:



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

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

- (::VertxWeb::Route) connectWithRegex(regex)

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

Parameters:

  • regex (String)
    URI paths that begin with a match for this regex will match

Returns:



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

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

- (::VertxWeb::Route) delete - (::VertxWeb::Route) delete(path)

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

Overloads:

  • - (::VertxWeb::Route) delete(path)

    Parameters:

    • path (String)
      URI paths that begin with this path will match

Returns:



59
60
61
62
63
64
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 59

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

- (::VertxWeb::Route) deleteWithRegex(regex)

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

Parameters:

  • regex (String)
    URI paths that begin with a match for this regex will match

Returns:



501
502
503
504
505
506
507
508
509
510
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 501

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

- (::VertxWeb::Router) errorHandler(statusCode, errorHandler) { ... }

Specify an handler to handle an error for a particular status code. You can use to manage general errors too using status code 500. The handler will be called when the context fails and other failure handlers didn't write the reply or when an exception is thrown inside an handler. You must not use VertxWeb::RoutingContext#next inside the error handler This does not affect the normal failure routing logic.

Parameters:

  • statusCode (Fixnum)
    status code the errorHandler is capable of handle

Yields:

Returns:



443
444
445
446
447
448
449
450
451
452
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 443

def error_handler(*args)
  if args[0].class == Fixnum && true
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:errorHandler, [Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::RoutingContext)) unless !block_given? })),::VertxWeb::Router)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling error_handler(#{args[0]})"
  end
end

- (self) exceptionHandler(exceptionHandler) { ... }

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)


472
473
474
475
476
477
478
479
480
481
482
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 472

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

- (::VertxWeb::Route) get - (::VertxWeb::Route) get(path)

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

Overloads:

  • - (::VertxWeb::Route) get(path)

    Parameters:

    • path (String)
      URI paths that begin with this path will match

Returns:



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

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

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

Returns a list of all the routes on this router

Returns:



375
376
377
378
379
380
381
382
383
384
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 375

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
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_routes()"
  end
end

- (::VertxWeb::Route) getWithRegex(regex)

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

Parameters:

  • regex (String)
    URI paths that begin with a match for this regex will match

Returns:



487
488
489
490
491
492
493
494
495
496
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 487

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

- (void) handle(event)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:



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

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

- (void) handleContext(context)

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:



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

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

- (void) handleFailure(context)

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:



330
331
332
333
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 330

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

- (::VertxWeb::Route) head - (::VertxWeb::Route) head(path)

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

Overloads:

  • - (::VertxWeb::Route) head(path)

    Parameters:

    • path (String)
      URI paths that begin with this path will match

Returns:



110
111
112
113
114
115
116
117
118
119
120
121
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 110

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

- (::VertxWeb::Route) headWithRegex(regex)

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

Parameters:

  • regex (String)
    URI paths that begin with a match for this regex will match

Returns:



272
273
274
275
276
277
278
279
280
281
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 272

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

- (self) mountSubRouter(mountPoint, subRouter)

Mount a sub router on this router

Parameters:

  • mountPoint (String)
    the mount point (path prefix) to mount it on
  • subRouter (::VertxWeb::Router)
    the router to mount as a sub router

Returns:

  • (self)


287
288
289
290
291
292
293
294
295
296
297
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 287

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

- (::VertxWeb::Route) options - (::VertxWeb::Route) options(path)

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

Overloads:

  • - (::VertxWeb::Route) options(path)

    Parameters:

    • path (String)
      URI paths that begin with this path will match

Returns:



192
193
194
195
196
197
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 192

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

- (::VertxWeb::Route) optionsWithRegex(regex)

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

Parameters:

  • regex (String)
    URI paths that begin with a match for this regex will match

Returns:



457
458
459
460
461
462
463
464
465
466
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 457

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

- (::VertxWeb::Route) patch - (::VertxWeb::Route) patch(path)

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

Overloads:

  • - (::VertxWeb::Route) patch(path)

    Parameters:

    • path (String)
      URI paths that begin with this path will match

Returns:



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

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

- (::VertxWeb::Route) patchWithRegex(regex)

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

Parameters:

  • regex (String)
    URI paths that begin with a match for this regex will match

Returns:



425
426
427
428
429
430
431
432
433
434
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 425

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

- (::VertxWeb::Route) post - (::VertxWeb::Route) post(path)

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

Overloads:

  • - (::VertxWeb::Route) post(path)

    Parameters:

    • path (String)
      URI paths that begin with this path will match

Returns:



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

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

- (::VertxWeb::Route) postWithRegex(regex)

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

Parameters:

  • regex (String)
    URI paths that begin with a match for this regex will match

Returns:



222
223
224
225
226
227
228
229
230
231
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 222

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

- (::VertxWeb::Route) put - (::VertxWeb::Route) put(path)

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

Overloads:

  • - (::VertxWeb::Route) put(path)

    Parameters:

    • path (String)
      URI paths that begin with this path will match

Returns:



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

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

- (::VertxWeb::Route) putWithRegex(regex)

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

Parameters:

  • regex (String)
    URI paths that begin with a match for this regex will match

Returns:



389
390
391
392
393
394
395
396
397
398
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 389

def put_with_regex(*args)
  if args[0].class == String && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:putWithRegex, [Java::java.lang.String.java_class]).call(args[0]),::VertxWeb::Route)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling put_with_regex(#{args[0]})"
  end
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:



407
408
409
410
411
412
413
414
415
416
417
418
419
420
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 407

def route(*args)
  if !block_given? && args[0] == nil && args[1] == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:route, []).call(),::VertxWeb::Route)
  elsif args[0].class == String && !block_given? && args[1] == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:route, [Java::java.lang.String.java_class]).call(args[0]),::VertxWeb::Route)
  elsif args[0].class == Symbol && args[1].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(args[0].to_s),args[1]),::VertxWeb::Route)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling route(#{args[0]},#{args[1]})"
  end
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:



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

def route_with_regex(*args)
  if args[0].class == String && !block_given? && args[1] == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:routeWithRegex, [Java::java.lang.String.java_class]).call(args[0]),::VertxWeb::Route)
  elsif args[0].class == Symbol && args[1].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(args[0].to_s),args[1]),::VertxWeb::Route)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling route_with_regex(#{args[0]},#{args[1]})"
  end
end

- (::VertxWeb::Route) trace - (::VertxWeb::Route) trace(path)

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

Overloads:

  • - (::VertxWeb::Route) trace(path)

    Parameters:

    • path (String)
      URI paths that begin with this path will match

Returns:



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

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

- (::VertxWeb::Route) traceWithRegex(regex)

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

Parameters:

  • regex (String)
    URI paths that begin with a match for this regex will match

Returns:



363
364
365
366
367
368
369
370
371
372
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/router.rb', line 363

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