Packages

class Router extends Handler[HttpServerRequest]

A router receives request from an io.vertx.scala.core.http.HttpServer and routes it to the first matching io.vertx.scala.ext.web.Route that it contains. A router can contain many routes.

Routers are also used for routing failures.

Linear Supertypes
Handler[HttpServerRequest], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Router
  2. Handler
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Router(_asJava: AnyRef)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def accept(request: HttpServerRequest): Unit

    This method is used to provide a request to the router.

    This method is used to provide a request to the router. Usually you take request from the io.vertx.scala.core.http.HttpServer#requestHandler 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. * @param request the request

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def asJava: AnyRef
  7. def clear(): Router

    Remove all the routes from this router * @return a reference to this, so the API can be used fluently

  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  9. def connect(path: String): Route

    Add a route that matches a HTTP CONNECT request and the specified path * @param path URI paths that begin with this path will match

    Add a route that matches a HTTP CONNECT request and the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  10. def connect(): Route

    Add a route that matches any HTTP CONNECT request * @return the route

  11. def connectWithRegex(regex: String): Route

    Add a route that matches a HTTP CONNECT request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches a HTTP CONNECT request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  12. def delete(path: String): Route

    Add a route that matches a HTTP DELETE request and the specified path * @param path URI paths that begin with this path will match

    Add a route that matches a HTTP DELETE request and the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  13. def delete(): Route

    Add a route that matches any HTTP DELETE request * @return the route

  14. def deleteWithRegex(regex: String): Route

    Add a route that matches a HTTP DELETE request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches a HTTP DELETE request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  17. def errorHandler(statusCode: Int, errorHandler: Handler[RoutingContext]): Router

    Specify an handler to handle an error for a particular status code.

    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 io.vertx.scala.ext.web.RoutingContext#next inside the error handler This does not affect the normal failure routing logic. * @param 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

  18. def exceptionHandler(exceptionHandler: Handler[Throwable]): Router

    Specify a handler for any unhandled exceptions on this router.

    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. * @param exceptionHandler the exception handler

    returns

    a reference to this, so the API can be used fluently

  19. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def get(path: String): Route

    Add a route that matches a HTTP GET request and the specified path * @param path URI paths that begin with this path will match

    Add a route that matches a HTTP GET request and the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  21. def get(): Route

    Add a route that matches any HTTP GET request * @return the route

  22. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  23. def getRoutes(): Buffer[Route]

    returns

    a list of all the routes on this router

  24. def getWithRegex(regex: String): Route

    Add a route that matches a HTTP GET request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches a HTTP GET request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  25. def handle(arg0: HttpServerRequest): Unit
    Definition Classes
    Router → Handler
  26. def handleContext(context: RoutingContext): Unit

    Used to route a context to the router.

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

  27. def handleFailure(context: RoutingContext): Unit

    Used to route a failure to the router.

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

  28. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. def head(path: String): Route

    Add a route that matches a HTTP HEAD request and the specified path * @param path URI paths that begin with this path will match

    Add a route that matches a HTTP HEAD request and the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  30. def head(): Route

    Add a route that matches any HTTP HEAD request * @return the route

  31. def headWithRegex(regex: String): Route

    Add a route that matches a HTTP HEAD request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches a HTTP HEAD request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  32. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  33. def mountSubRouter(mountPoint: String, subRouter: Router): Router

    Mount a sub router on this router * @param mountPoint the mount point (path prefix) to mount it on

    Mount a sub router on this router * @param 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

  34. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  35. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  36. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  37. def options(path: String): Route

    Add a route that matches a HTTP OPTIONS request and the specified path * @param path URI paths that begin with this path will match

    Add a route that matches a HTTP OPTIONS request and the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  38. def options(): Route

    Add a route that matches any HTTP OPTIONS request * @return the route

  39. def optionsWithRegex(regex: String): Route

    Add a route that matches a HTTP OPTIONS request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches a HTTP OPTIONS request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  40. def patch(path: String): Route

    Add a route that matches a HTTP PATCH request and the specified path * @param path URI paths that begin with this path will match

    Add a route that matches a HTTP PATCH request and the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  41. def patch(): Route

    Add a route that matches any HTTP PATCH request * @return the route

  42. def patchWithRegex(regex: String): Route

    Add a route that matches a HTTP PATCH request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches a HTTP PATCH request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  43. def post(path: String): Route

    Add a route that matches a HTTP POST request and the specified path * @param path URI paths that begin with this path will match

    Add a route that matches a HTTP POST request and the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  44. def post(): Route

    Add a route that matches any HTTP POST request * @return the route

  45. def postWithRegex(regex: String): Route

    Add a route that matches a HTTP POST request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches a HTTP POST request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  46. def put(path: String): Route

    Add a route that matches a HTTP PUT request and the specified path * @param path URI paths that begin with this path will match

    Add a route that matches a HTTP PUT request and the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  47. def put(): Route

    Add a route that matches any HTTP PUT request * @return the route

  48. def putWithRegex(regex: String): Route

    Add a route that matches a HTTP PUT request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches a HTTP PUT request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  49. def route(path: String): Route

    Add a route that matches the specified path * @param path URI paths that begin with this path will match

    Add a route that matches the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  50. def route(method: HttpMethod, path: String): Route

    Add a route that matches the specified HTTP method and path * @param method the HTTP method to match

    Add a route that matches the specified HTTP method and path * @param method the HTTP method to match

    path

    URI paths that begin with this path will match

    returns

    the route

  51. def route(): Route

    Add a route with no matching criteria, i.e.

    Add a route with no matching criteria, i.e. it matches all requests or failures. * @return the route

  52. def routeWithRegex(regex: String): Route

    Add a route that matches the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  53. def routeWithRegex(method: HttpMethod, regex: String): Route

    Add a route that matches the specified HTTP method and path regex * @param method the HTTP method to match

    Add a route that matches the specified HTTP method and path regex * @param method the HTTP method to match

    regex

    URI paths that begin with a match for this regex will match

    returns

    the route

  54. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  55. def toString(): String
    Definition Classes
    AnyRef → Any
  56. def trace(path: String): Route

    Add a route that matches a HTTP TRACE request and the specified path * @param path URI paths that begin with this path will match

    Add a route that matches a HTTP TRACE request and the specified path * @param path URI paths that begin with this path will match

    returns

    the route

  57. def trace(): Route

    Add a route that matches any HTTP TRACE request * @return the route

  58. def traceWithRegex(regex: String): Route

    Add a route that matches a HTTP TRACE request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    Add a route that matches a HTTP TRACE request and the specified path regex * @param regex URI paths that begin with a match for this regex will match

    returns

    the route

  59. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  60. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  61. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from Handler[HttpServerRequest]

Inherited from AnyRef

Inherited from Any

Ungrouped