Skip to content

Commit

Permalink
Fix code samples for nested router functions
Browse files Browse the repository at this point in the history
Closes gh-28603
  • Loading branch information
poutsma committed Jun 10, 2022
1 parent babff8e commit 27738cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions src/docs/asciidoc/web/webflux-functional.adoc
Expand Up @@ -590,10 +590,10 @@ RouterFunction<ServerResponse> route = route()
.path("/person", builder -> builder // <1>
.GET("/{id}", accept(APPLICATION_JSON), handler::getPerson)
.GET(accept(APPLICATION_JSON), handler::listPeople)
.POST("/person", handler::createPerson))
.POST(handler::createPerson))
.build();
----
<1> Note that second parameter of `path` is a consumer that takes the a router builder.
<1> Note that second parameter of `path` is a consumer that takes the router builder.

[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
Expand All @@ -602,7 +602,7 @@ RouterFunction<ServerResponse> route = route()
"/person".nest {
GET("/{id}", accept(APPLICATION_JSON), handler::getPerson)
GET(accept(APPLICATION_JSON), handler::listPeople)
POST("/person", handler::createPerson)
POST(handler::createPerson)
}
}
----
Expand All @@ -620,7 +620,7 @@ We can further improve by using the `nest` method together with `accept`:
.nest(accept(APPLICATION_JSON), b2 -> b2
.GET("/{id}", handler::getPerson)
.GET(handler::listPeople))
.POST("/person", handler::createPerson))
.POST(handler::createPerson))
.build();
----
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
Expand All @@ -631,7 +631,7 @@ We can further improve by using the `nest` method together with `accept`:
accept(APPLICATION_JSON).nest {
GET("/{id}", handler::getPerson)
GET(handler::listPeople)
POST("/person", handler::createPerson)
POST(handler::createPerson)
}
}
}
Expand Down Expand Up @@ -766,7 +766,7 @@ For instance, consider the following example:
.before(request -> ServerRequest.from(request) // <1>
.header("X-RequestHeader", "Value")
.build()))
.POST("/person", handler::createPerson))
.POST(handler::createPerson))
.after((request, response) -> logResponse(response)) // <2>
.build();
----
Expand All @@ -784,7 +784,7 @@ For instance, consider the following example:
ServerRequest.from(it)
.header("X-RequestHeader", "Value").build()
}
POST("/person", handler::createPerson)
POST(handler::createPerson)
after { _, response -> // <2>
logResponse(response)
}
Expand Down Expand Up @@ -815,7 +815,7 @@ The following example shows how to do so:
.nest(accept(APPLICATION_JSON), b2 -> b2
.GET("/{id}", handler::getPerson)
.GET(handler::listPeople))
.POST("/person", handler::createPerson))
.POST(handler::createPerson))
.filter((request, next) -> {
if (securityManager.allowAccessTo(request.path())) {
return next.handle(request);
Expand All @@ -835,7 +835,7 @@ The following example shows how to do so:
("/person" and accept(APPLICATION_JSON)).nest {
GET("/{id}", handler::getPerson)
GET("", handler::listPeople)
POST("/person", handler::createPerson)
POST(handler::createPerson)
filter { request, next ->
if (securityManager.allowAccessTo(request.path())) {
next(request)
Expand Down
16 changes: 8 additions & 8 deletions src/docs/asciidoc/web/webmvc-functional.adoc
Expand Up @@ -612,7 +612,7 @@ RouterFunction<ServerResponse> route = route()
.path("/person", builder -> builder // <1>
.GET("/{id}", accept(APPLICATION_JSON), handler::getPerson)
.GET(accept(APPLICATION_JSON), handler::listPeople)
.POST("/person", handler::createPerson))
.POST(handler::createPerson))
.build();
----
<1> Note that second parameter of `path` is a consumer that takes the router builder.
Expand All @@ -626,7 +626,7 @@ RouterFunction<ServerResponse> route = route()
"/person".nest {
GET("/{id}", accept(APPLICATION_JSON), handler::getPerson)
GET(accept(APPLICATION_JSON), handler::listPeople)
POST("/person", handler::createPerson)
POST(handler::createPerson)
}
}
----
Expand All @@ -644,7 +644,7 @@ We can further improve by using the `nest` method together with `accept`:
.nest(accept(APPLICATION_JSON), b2 -> b2
.GET("/{id}", handler::getPerson)
.GET(handler::listPeople))
.POST("/person", handler::createPerson))
.POST(handler::createPerson))
.build();
----
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
Expand All @@ -657,7 +657,7 @@ We can further improve by using the `nest` method together with `accept`:
accept(APPLICATION_JSON).nest {
GET("/{id}", handler::getPerson)
GET("", handler::listPeople)
POST("/person", handler::createPerson)
POST(handler::createPerson)
}
}
}
Expand Down Expand Up @@ -779,7 +779,7 @@ For instance, consider the following example:
.before(request -> ServerRequest.from(request) // <1>
.header("X-RequestHeader", "Value")
.build()))
.POST("/person", handler::createPerson))
.POST(handler::createPerson))
.after((request, response) -> logResponse(response)) // <2>
.build();
----
Expand All @@ -800,7 +800,7 @@ For instance, consider the following example:
.header("X-RequestHeader", "Value").build()
}
}
POST("/person", handler::createPerson)
POST(handler::createPerson)
after { _, response -> // <2>
logResponse(response)
}
Expand Down Expand Up @@ -830,7 +830,7 @@ The following example shows how to do so:
.nest(accept(APPLICATION_JSON), b2 -> b2
.GET("/{id}", handler::getPerson)
.GET(handler::listPeople))
.POST("/person", handler::createPerson))
.POST(handler::createPerson))
.filter((request, next) -> {
if (securityManager.allowAccessTo(request.path())) {
return next.handle(request);
Expand All @@ -852,7 +852,7 @@ The following example shows how to do so:
("/person" and accept(APPLICATION_JSON)).nest {
GET("/{id}", handler::getPerson)
GET("", handler::listPeople)
POST("/person", handler::createPerson)
POST(handler::createPerson)
filter { request, next ->
if (securityManager.allowAccessTo(request.path())) {
next(request)
Expand Down

0 comments on commit 27738cc

Please sign in to comment.