public class RouteMatcherImpl extends Object implements RouteMatcher
RouteMatcher also lets you extract parameters from the request URI either a simple pattern or using regular expressions for more complex matches. Any parameters extracted will be added to the requests parameters which will be available to you in your request handler.
It's particularly useful when writing REST-ful web applications.
To use a simple pattern to extract parameters simply prefix the parameter name in the pattern with a ':' (colon).
Different handlers can be specified for each of the HTTP verbs, GET, POST, PUT, DELETE etc.
For more complex matches regular expressions can be used in the pattern. When regular expressions are used, the extracted parameters do not have a name, so they are put into the HTTP request with names of param0, param1, param2 etc.
Multiple matches can be specified for each HTTP verb. In the case there are more than one matching patterns for a particular request, the first matching one will be used.
Instances of this class are not thread-safe
| Constructor and Description |
|---|
RouteMatcherImpl()
Do not instantiate this directly - use RouteMatcher.newRouteMatcher() instead
|
| Modifier and Type | Method and Description |
|---|---|
RouteMatcher |
accept(io.vertx.core.http.HttpServerRequest request) |
RouteMatcherImpl |
all(String pattern,
io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
Specify a handler that will be called for all HTTP methods
|
RouteMatcherImpl |
allWithRegEx(String regex,
io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
Specify a handler that will be called for all HTTP methods
|
RouteMatcher |
matchMethod(io.vertx.core.http.HttpMethod method,
String pattern,
io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
Specify a handler that will be called for a matching request
|
RouteMatcher |
matchMethodWithRegEx(io.vertx.core.http.HttpMethod method,
String regex,
io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
Specify a handler that will be called for a matching request
|
RouteMatcherImpl |
noMatch(io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
Specify a handler that will be called when no other handlers match.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrouteMatcherpublic RouteMatcherImpl()
public RouteMatcher accept(io.vertx.core.http.HttpServerRequest request)
accept in interface RouteMatcherpublic RouteMatcher matchMethod(io.vertx.core.http.HttpMethod method, String pattern, io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
RouteMatchermatchMethod in interface RouteMatchermethod - - the HTTP methodpattern - The simple patternhandler - The handler to callpublic RouteMatcher matchMethodWithRegEx(io.vertx.core.http.HttpMethod method, String regex, io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
RouteMatchermatchMethodWithRegEx in interface RouteMatchermethod - - the HTTP methodregex - The simple patternhandler - The handler to callpublic RouteMatcherImpl all(String pattern, io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
all in interface RouteMatcherpattern - The simple patternhandler - The handler to callpublic RouteMatcherImpl allWithRegEx(String regex, io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
allWithRegEx in interface RouteMatcherregex - A regular expressionhandler - The handler to callpublic RouteMatcherImpl noMatch(io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> handler)
noMatch in interface RouteMatcherCopyright © 2014. All Rights Reserved.