Package io.vertx.mutiny.ext.web
Class Router
- java.lang.Object
-
- io.vertx.mutiny.ext.web.Router
-
- All Implemented Interfaces:
io.vertx.core.Handler<HttpServerRequest>
,Consumer<HttpServerRequest>
public class Router extends Object implements io.vertx.core.Handler<HttpServerRequest>, Consumer<HttpServerRequest>
A router receives request from anHttpServer
and routes it to the first matchingRoute
that it contains. A router can contain many routes.Routers are also used for routing failures.
NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<Router>
__TYPE_ARG
-
Method Summary
-
-
-
Constructor Detail
-
Router
public Router(io.vertx.ext.web.Router delegate)
-
Router
public Router(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.ext.web.Router getDelegate()
-
handle
public void handle(HttpServerRequest arg0)
- Specified by:
handle
in interfaceio.vertx.core.Handler<HttpServerRequest>
-
putMetadata
public Router putMetadata(String key, Object value)
- Parameters:
key
- the metadata of keyvalue
- 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 matchpath
- 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 matchregex
- 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
-
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 fromRoute.subRouter(Router)
. Mount a sub router on this router- Parameters:
mountPoint
- the mount point (path prefix) to mount it onsubRouter
- 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 handleerrorHandler
- error handler. Note: You must not useRoutingContext.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 interfaceConsumer<HttpServerRequest>
-
newInstance
public static Router newInstance(io.vertx.ext.web.Router arg)
-
-