6 Routing
6.1 What is routing?
In Kauri, routing means the problem of mapping an incoming request
to a
Routing is usually done based on the request URI, in particular its path component.
http://kauriproject.org/documentation/tutorial.html?foo=bar&foo2=bar2 <--> <----------------><--------------------------><----------------> scheme authority path query string
If you are familiar with other web-frameworks supporting configurable
routing, you are probably wondering how the routing is configured in Kauri. For
completeness, you should know there are multiple levels of routing (see next
section), but the most interesting one is how routing is done within a
builder.router {
resource(uri: "/user/{name}", ofClass: "mystuff.UserResource")
resource(uri: "/order/{orderId}", ofClass: "mystuff.OrderResource")
}
The syntax of this file is Groovy using the Groovy Builder convention. The
uri patterns are defined using
This is a very basic example, there are lots of other possibilities described later on.
Previous