io.vertx.rxjava.ext.web

## Class Router

- java.lang.Object
- - io.vertx.rxjava.ext.web.Router

- All Implemented Interfaces:
    Handler<HttpServerRequest>

      public class Router
      extends Object
      implements Handler<HttpServerRequest>

  A router receives request from an `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.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<Router>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Router(Object delegate)`
    `Router(Router delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `accept(HttpServerRequest request)` Deprecated.
    `Router` | `clear()` Remove all the routes from this router
    `Route` | `connect()` Add a route that matches any HTTP CONNECT request
    `Route` | `connect(String path)` Add a route that matches a HTTP CONNECT request and the specified path
    `Route` | `connectWithRegex(String regex)` Add a route that matches a HTTP CONNECT request and the specified path regex
    `Route` | `delete()` Add a route that matches any HTTP DELETE request
    `Route` | `delete(String path)` Add a route that matches a HTTP DELETE request and the specified path
    `Route` | `deleteWithRegex(String regex)` Add a route that matches a HTTP DELETE request and the specified path regex
    `boolean` | `equals(Object o)`
    `Router` | `errorHandler(int statusCode, Handler<RoutingContext> errorHandler)` Specify an handler to handle an error for a particular status code.
    `Router` | `exceptionHandler(Handler<Throwable> exceptionHandler)` Deprecated.
    `Route` | `get()` Add a route that matches any HTTP GET request
    `Route` | `get(String path)` Add a route that matches a HTTP GET request and the specified path
    `Router` | `getDelegate()`
    `List<Route>` | `getRoutes()`
    `Route` | `getWithRegex(String regex)` Add a route that matches a HTTP GET request and the specified path regex
    `void` | `handle(HttpServerRequest event)` Something has happened, so handle it.
    `void` | `handleContext(RoutingContext context)` Used to route a context to the router.
    `void` | `handleFailure(RoutingContext context)` Used to route a failure to the router.
    `int` | `hashCode()`
    `Route` | `head()` Add a route that matches any HTTP HEAD request
    `Route` | `head(String path)` Add a route that matches a HTTP HEAD request and the specified path
    `Route` | `headWithRegex(String regex)` Add a route that matches a HTTP HEAD request and the specified path regex
    `Router` | `modifiedHandler(Handler<Router> handler)` When a Router routes are changed this handler is notified.
    `Router` | `mountSubRouter(String mountPoint, Router subRouter)` Mount a sub router on this router
    `static Router` | `newInstance(Router arg)`
    `Route` | `options()` Add a route that matches any HTTP OPTIONS request
    `Route` | `options(String path)` Add a route that matches a HTTP OPTIONS request and the specified path
    `Route` | `optionsWithRegex(String regex)` Add a route that matches a HTTP OPTIONS request and the specified path regex
    `Route` | `patch()` Add a route that matches any HTTP PATCH request
    `Route` | `patch(String path)` Add a route that matches a HTTP PATCH request and the specified path
    `Route` | `patchWithRegex(String regex)` Add a route that matches a HTTP PATCH request and the specified path regex
    `Route` | `post()` Add a route that matches any HTTP POST request
    `Route` | `post(String path)` Add a route that matches a HTTP POST request and the specified path
    `Route` | `postWithRegex(String regex)` Add a route that matches a HTTP POST request and the specified path regex
    `Route` | `put()` Add a route that matches any HTTP PUT request
    `Route` | `put(String path)` Add a route that matches a HTTP PUT request and the specified path
    `Route` | `putWithRegex(String regex)` Add a route that matches a HTTP PUT request and the specified path regex
    `Route` | `route()` Add a route with no matching criteria, i.e.
    `Route` | `route(HttpMethod method, String path)` Add a route that matches the specified HTTP method and path
    `Route` | `route(String path)` Add a route that matches the specified path
    `static Router` | `router(Vertx vertx)` Create a router
    `Route` | `routeWithRegex(HttpMethod method, String regex)` Add a route that matches the specified HTTP method and path regex
    `Route` | `routeWithRegex(String regex)` Add a route that matches the specified path regex
    `String` | `toString()`
    `Route` | `trace()` Add a route that matches any HTTP TRACE request
    `Route` | `trace(String path)` Add a route that matches a HTTP TRACE request and the specified path
    `Route` | `traceWithRegex(String regex)` Add a route that matches a HTTP TRACE request and the specified path regex

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<Router> __TYPE_ARG

  - ### Constructor Detail

    - #### Router

          public Router(Router delegate)

    - #### Router

          public Router(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public Router getDelegate()

    - #### handle

          public void handle(HttpServerRequest event)

      Something has happened, so handle it.
      Specified by:
        `handle` in interface `Handler<HttpServerRequest>`
      Parameters:
        `event` - the event to handle

    - #### router

          public static Router router(Vertx vertx)

      Create a router
      Parameters:
        `vertx` - the Vert.x instance
      Returns:
        the router

    - #### accept

          @Deprecated
          public void accept(HttpServerRequest request)

      Deprecated.
      This method is used to provide a request to the router. Usually you take request from the `HttpServer.requestHandler(io.vertx.core.Handler<io.vertx.rxjava.core.http.HttpServerRequest>)` 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` - the request

    - #### route

          public Route route()

      Add a route with no matching criteria, i.e. it matches all requests or failures.
      Returns:
        the route

    - #### route

          public Route route(HttpMethod method,
                             String path)

      Add a route that matches the specified HTTP method and path
      Parameters:
        `method` - the HTTP method to match
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### route

          public Route route(String path)

      Add a route that matches the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### routeWithRegex

          public Route routeWithRegex(HttpMethod method,
                                      String regex)

      Add a route that matches the specified HTTP method and path regex
      Parameters:
        `method` - the HTTP method to match
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### routeWithRegex

          public Route routeWithRegex(String regex)

      Add a route that matches the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### get

          public Route get()

      Add a route that matches any HTTP GET request
      Returns:
        the route

    - #### get

          public Route get(String path)

      Add a route that matches a HTTP GET request and the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### getWithRegex

          public Route getWithRegex(String regex)

      Add a route that matches a HTTP GET request and the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### head

          public Route head()

      Add a route that matches any HTTP HEAD request
      Returns:
        the route

    - #### head

          public Route head(String path)

      Add a route that matches a HTTP HEAD request and the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### headWithRegex

          public Route headWithRegex(String regex)

      Add a route that matches a HTTP HEAD request and the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### options

          public Route options()

      Add a route that matches any HTTP OPTIONS request
      Returns:
        the route

    - #### options

          public Route options(String path)

      Add a route that matches a HTTP OPTIONS request and the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### optionsWithRegex

          public Route optionsWithRegex(String regex)

      Add a route that matches a HTTP OPTIONS request and the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### put

          public Route put()

      Add a route that matches any HTTP PUT request
      Returns:
        the route

    - #### put

          public Route put(String path)

      Add a route that matches a HTTP PUT request and the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### putWithRegex

          public Route putWithRegex(String regex)

      Add a route that matches a HTTP PUT request and the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### post

          public Route post()

      Add a route that matches any HTTP POST request
      Returns:
        the route

    - #### post

          public Route post(String path)

      Add a route that matches a HTTP POST request and the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### postWithRegex

          public Route postWithRegex(String regex)

      Add a route that matches a HTTP POST request and the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### delete

          public Route delete()

      Add a route that matches any HTTP DELETE request
      Returns:
        the route

    - #### delete

          public Route delete(String path)

      Add a route that matches a HTTP DELETE request and the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### deleteWithRegex

          public Route deleteWithRegex(String regex)

      Add a route that matches a HTTP DELETE request and the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### trace

          public Route trace()

      Add a route that matches any HTTP TRACE request
      Returns:
        the route

    - #### trace

          public Route trace(String path)

      Add a route that matches a HTTP TRACE request and the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### traceWithRegex

          public Route traceWithRegex(String regex)

      Add a route that matches a HTTP TRACE request and the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### connect

          public Route connect()

      Add a route that matches any HTTP CONNECT request
      Returns:
        the route

    - #### connect

          public Route connect(String path)

      Add a route that matches a HTTP CONNECT request and the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### connectWithRegex

          public Route connectWithRegex(String regex)

      Add a route that matches a HTTP CONNECT request and the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### patch

          public Route patch()

      Add a route that matches any HTTP PATCH request
      Returns:
        the route

    - #### patch

          public Route patch(String path)

      Add a route that matches a HTTP PATCH request and the specified path
      Parameters:
        `path` - URI paths that begin with this path will match
      Returns:
        the route

    - #### patchWithRegex

          public Route patchWithRegex(String regex)

      Add a route that matches a HTTP PATCH request and the specified path regex
      Parameters:
        `regex` - URI paths that begin with a match for this regex will match
      Returns:
        the route

    - #### getRoutes

          public List<Route> getRoutes()

      Returns:
        a list of all the routes on this router

    - #### clear

          public Router clear()

      Remove all the routes from this router
      Returns:
        a reference to this, so the API can be used fluently

    - #### mountSubRouter

          public Router mountSubRouter(String mountPoint,
                                       Router subRouter)

      Mount a sub router on this router
      Parameters:
        `mountPoint` - the mount point (path prefix) to mount it on
        `subRouter` - the router to mount as a sub router
      Returns:
        a reference to this, so the API can be used fluently

    - #### exceptionHandler

          @Deprecated
          public Router exceptionHandler(Handler<Throwable> exceptionHandler)

      Deprecated.
      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.
      Parameters:
        `exceptionHandler` - the exception handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### errorHandler

          public Router errorHandler(int statusCode,
                                     Handler<RoutingContext> 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 `RoutingContext.next()` inside the error handler This does not affect the normal failure routing logic.
      Parameters:
        `statusCode` - status code the errorHandler is capable of handle
        `errorHandler` - error handler. Note: You must not use `RoutingContext.next()` inside the provided handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### handleContext

          public void handleContext(RoutingContext context)

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

    - #### handleFailure

          public void handleFailure(RoutingContext context)

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

    - #### modifiedHandler

          public Router modifiedHandler(Handler<Router> handler)

      When a Router routes are changed this handler is notified. This is useful for routes that depend on the state of the router.
      Parameters:
        `handler` - a notification handler that will receive this router as argument
      Returns:
        a reference to this, so the API can be used fluently

    - #### newInstance

          public static Router newInstance(Router arg)

Copyright © 2022 Eclipse. All rights reserved.