class Route extends AnyRef
A route is a holder for a set of criteria which determine whether an HTTP request or failure should be routed to a handler.
- Alphabetic
- By Inheritance
- Route
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Route(_asJava: AnyRef)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava: AnyRef
-
def
blockingHandler(requestHandler: Handler[RoutingContext], ordered: Boolean): Route
Specify a blocking request handler for the route.
Specify a blocking request handler for the route. This method works just like io.vertx.scala.ext.web.Route#handler excepted that it will run the blocking handler on a worker thread so that it won't block the event loop. Note that it's safe to call context.next() from the blocking handler as it will be executed on the event loop context (and not on the worker thread.
If the blocking handler is ordered it means that any blocking handlers for the same context are never executed concurrently but always in the order they were called. The default value of ordered is true. If you do not want this behaviour and don't mind if your blocking handlers are executed in parallel you can set ordered to false. * @param requestHandler the blocking request handler
- ordered
if true handlers are executed in sequence, otherwise are run in parallel
- returns
a reference to this, so the API can be used fluently
-
def
blockingHandler(requestHandler: Handler[RoutingContext]): Route
Like io.vertx.scala.ext.web.Route#blockingHandler called with ordered = true
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
consumes(contentType: String): Route
Add a content type consumed by this route.
Add a content type consumed by this route. Used for content based routing. * @param contentType the content type
- returns
a reference to this, so the API can be used fluently
-
def
disable(): Route
Disable this route.
Disable this route. While disabled the router will not route any requests or failures to it. * @return a reference to this, so the API can be used fluently
-
def
enable(): Route
Enable this route.
Enable this route. * @return a reference to this, so the API can be used fluently
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
failureHandler(failureHandler: Handler[RoutingContext]): Route
Append a failure handler to the route failure handlers list.
Append a failure handler to the route failure handlers list. The router routes failures to failurehandlers depending on whether the various criteria such as method, path, etc match. When method, path, etc are the same for different routes, You should add multiple failure handlers to the same route object rather than creating two different routes objects with one failure handler for route * @param failureHandler the request handler
- returns
a reference to this, so the API can be used fluently
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getPath(): Option[String]
- returns
the path prefix (if any) for this route
-
def
handler(requestHandler: Handler[RoutingContext]): Route
Append a request handler to the route handlers list.
Append a request handler to the route handlers list. The router routes requests to handlers depending on whether the various criteria such as method, path, etc match. When method, path, etc are the same for different routes, You should add multiple handlers to the same route object rather than creating two different routes objects with one handler for route * @param requestHandler the request handler
- returns
a reference to this, so the API can be used fluently
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
last(): Route
Specify this is the last route for the router.
Specify this is the last route for the router. * @return a reference to this, so the API can be used fluently
-
def
method(method: HttpMethod): Route
Add an HTTP method for this route.
Add an HTTP method for this route. By default a route will match all HTTP methods. If any are specified then the route will only match any of the specified methods * @param method the HTTP method to add
- returns
a reference to this, so the API can be used fluently
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
order(order: Int): Route
Specify the order for this route.
Specify the order for this route. The router tests routes in that order. * @param order the order
- returns
a reference to this, so the API can be used fluently
-
def
path(path: String): Route
Set the path prefix for this route.
Set the path prefix for this route. If set then this route will only match request URI paths which start with this path prefix. Only a single path or path regex can be set for a route. * @param path the path prefix
- returns
a reference to this, so the API can be used fluently
-
def
pathRegex(path: String): Route
Set the path prefix as a regular expression.
Set the path prefix as a regular expression. If set then this route will only match request URI paths, the beginning of which match the regex. Only a single path or path regex can be set for a route. * @param path the path regex
- returns
a reference to this, so the API can be used fluently
-
def
produces(contentType: String): Route
Add a content type produced by this route.
Add a content type produced by this route. Used for content based routing. * @param contentType the content type
- returns
a reference to this, so the API can be used fluently
-
def
remove(): Route
Remove this route from the router * @return a reference to this, so the API can be used fluently
-
def
setRegexGroupsNames(groups: Buffer[String]): Route
When you add a new route with a regular expression, you can add named capture groups for parameters.
When you add a new route with a regular expression, you can add named capture groups for parameters.
However, if you need more complex parameters names (like "param_name"), you can add parameters names with this function. You have to name capture groups in regex with names: "p0", "p1", "p2", ...
For example: If you declare route with regex \/(?<p0>[a-z]*)\/(?<p1>[a-z]*) and group names ["param_a", "param-b"] for uri /hello/world you receive inside pathParams() the parameter param_a = "hello" * @param groups group names- returns
a reference to this, so the API can be used fluently
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
useNormalisedPath(useNormalisedPath: Boolean): Route
If true then the normalised request path will be used when routing (e.g.
If true then the normalised request path will be used when routing (e.g. removing duplicate /) Default is true * @param useNormalisedPath use normalised path for routing?
- returns
a reference to this, so the API can be used fluently
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )