Add callouts to Kotlin examples for parity
This commit is contained in:
parent
bbfc39efc9
commit
cd27fbe550
|
@ -640,7 +640,7 @@ RouterFunction<ServerResponse> route = route()
|
||||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||||
.Kotlin
|
.Kotlin
|
||||||
----
|
----
|
||||||
val route = coRouter {
|
val route = coRouter { // <1>
|
||||||
"/person".nest {
|
"/person".nest {
|
||||||
GET("/{id}", accept(APPLICATION_JSON), handler::getPerson)
|
GET("/{id}", accept(APPLICATION_JSON), handler::getPerson)
|
||||||
GET(accept(APPLICATION_JSON), handler::listPeople)
|
GET(accept(APPLICATION_JSON), handler::listPeople)
|
||||||
|
@ -648,6 +648,7 @@ RouterFunction<ServerResponse> route = route()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
<1> Create router using Coroutines router DSL; a Reactive alternative is also available via `router { }`.
|
||||||
|
|
||||||
Though path-based nesting is the most common, you can nest on any kind of predicate by using
|
Though path-based nesting is the most common, you can nest on any kind of predicate by using
|
||||||
the `nest` method on the builder.
|
the `nest` method on the builder.
|
||||||
|
|
|
@ -623,13 +623,14 @@ RouterFunction<ServerResponse> route = route()
|
||||||
import org.springframework.web.servlet.function.router
|
import org.springframework.web.servlet.function.router
|
||||||
|
|
||||||
val route = router {
|
val route = router {
|
||||||
"/person".nest {
|
"/person".nest { // <1>
|
||||||
GET("/{id}", accept(APPLICATION_JSON), handler::getPerson)
|
GET("/{id}", accept(APPLICATION_JSON), handler::getPerson)
|
||||||
GET(accept(APPLICATION_JSON), handler::listPeople)
|
GET(accept(APPLICATION_JSON), handler::listPeople)
|
||||||
POST(handler::createPerson)
|
POST(handler::createPerson)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
<1> Using `nest` DSL.
|
||||||
|
|
||||||
Though path-based nesting is the most common, you can nest on any kind of predicate by using
|
Though path-based nesting is the most common, you can nest on any kind of predicate by using
|
||||||
the `nest` method on the builder.
|
the `nest` method on the builder.
|
||||||
|
|
Loading…
Reference in New Issue