Class Router

java.lang.Object
io.vertx.mutiny.ext.web.Router
All Implemented Interfaces:
MutinyDelegate, io.vertx.core.Handler<HttpServerRequest>, Consumer<HttpServerRequest>

public class Router extends Object implements MutinyDelegate, io.vertx.core.Handler<HttpServerRequest>, Consumer<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 Mutiny-ified interface using Vert.x codegen.

  • Field Details

  • Constructor Details

    • Router

      public Router(io.vertx.ext.web.Router delegate)
    • Router

      public Router(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.ext.web.Router getDelegate()
      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate used by this Mutiny object of generated type
    • 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
    • handle

      public void handle(HttpServerRequest arg0)
      Specified by:
      handle in interface io.vertx.core.Handler<HttpServerRequest>
    • putMetadata

      public Router putMetadata(String key, Object value)
      Parameters:
      key - the metadata of key
      value - the metadata of value
      Returns:
      a reference to this, so the API can be used fluently
    • metadata

      public Map<String,Object> metadata()
      Returns:
      the metadata of this router, never returns null.
    • getMetadata

      public <T> T getMetadata(String key)
      Parameters:
      key - the key for the metadata
      Returns:
      the data
    • router

      public static Router router(Vertx vertx)
      Parameters:
      vertx - the Vert.x instance
      Returns:
      the router
    • route

      public Route route()
      Returns:
      the route
    • route

      public Route route(io.vertx.core.http.HttpMethod method, String 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)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • routeWithRegex

      public Route routeWithRegex(io.vertx.core.http.HttpMethod method, String 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)
      Parameters:
      regex - URI paths that begin with a match for this regex will match
      Returns:
      the route
    • get

      public Route get()
      Returns:
      the route
    • get

      public Route get(String path)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • getWithRegex

      public Route getWithRegex(String regex)
      Parameters:
      regex - URI paths that begin with a match for this regex will match
      Returns:
      the route
    • head

      public Route head()
      Returns:
      the route
    • head

      public Route head(String path)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • headWithRegex

      public Route headWithRegex(String regex)
      Parameters:
      regex - URI paths that begin with a match for this regex will match
      Returns:
      the route
    • options

      public Route options()
      Returns:
      the route
    • options

      public Route options(String path)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • optionsWithRegex

      public Route optionsWithRegex(String regex)
      Parameters:
      regex - URI paths that begin with a match for this regex will match
      Returns:
      the route
    • put

      public Route put()
      Returns:
      the route
    • put

      public Route put(String path)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • putWithRegex

      public Route putWithRegex(String regex)
      Parameters:
      regex - URI paths that begin with a match for this regex will match
      Returns:
      the route
    • post

      public Route post()
      Returns:
      the route
    • post

      public Route post(String path)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • postWithRegex

      public Route postWithRegex(String regex)
      Parameters:
      regex - URI paths that begin with a match for this regex will match
      Returns:
      the route
    • delete

      public Route delete()
      Returns:
      the route
    • delete

      public Route delete(String path)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • deleteWithRegex

      public Route deleteWithRegex(String regex)
      Parameters:
      regex - URI paths that begin with a match for this regex will match
      Returns:
      the route
    • trace

      public Route trace()
      Returns:
      the route
    • trace

      public Route trace(String path)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • traceWithRegex

      public Route traceWithRegex(String regex)
      Parameters:
      regex - URI paths that begin with a match for this regex will match
      Returns:
      the route
    • connect

      public Route connect()
      Returns:
      the route
    • connect

      public Route connect(String path)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • connectWithRegex

      public Route connectWithRegex(String regex)
      Parameters:
      regex - URI paths that begin with a match for this regex will match
      Returns:
      the route
    • patch

      public Route patch()
      Returns:
      the route
    • patch

      public Route patch(String path)
      Parameters:
      path - URI paths that begin with this path will match
      Returns:
      the route
    • patchWithRegex

      public Route patchWithRegex(String 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()
      Returns:
      a reference to this, so the API can be used fluently
    • mountSubRouter

      @Deprecated public Route mountSubRouter(String mountPoint, Router subRouter)
      Deprecated.
      This method duplicates the sub router functionality from Route.subRouter(Router). 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
    • errorHandler

      public Router errorHandler(int statusCode, Consumer<RoutingContext> errorHandler)
      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:
    • handleContext

      public void handleContext(RoutingContext context)
      Parameters:
      context - the routing context
    • handleFailure

      public void handleFailure(RoutingContext context)
      Parameters:
      context - the routing context
    • modifiedHandler

      public Router modifiedHandler(Consumer<Router> handler)
      Parameters:
      handler - a notification handler that will receive this router as argument
      Returns:
    • allowForward

      public Router allowForward(io.vertx.ext.web.AllowForwardHeaders allowForwardHeaders)
      Parameters:
      allowForwardHeaders - to enable parsing of "forwarded"-type headers
      Returns:
      a reference to this, so the API can be used fluently
    • accept

      public void accept(HttpServerRequest item)
      Specified by:
      accept in interface Consumer<HttpServerRequest>
    • newInstance

      public static Router newInstance(io.vertx.ext.web.Router arg)