From 977582fcedd68486ee9ac541204db176808304c4 Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Wed, 3 Sep 2025 10:10:20 +0100 Subject: [PATCH] Document data binding for functional endpoints Closes gh-35367 --- .../ROOT/pages/web/webflux-functional.adoc | 23 ++++++++++++++++++- .../ROOT/pages/web/webmvc-functional.adoc | 20 ++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/framework-docs/modules/ROOT/pages/web/webflux-functional.adoc b/framework-docs/modules/ROOT/pages/web/webflux-functional.adoc index 882cb422e39..78f0fef09a2 100644 --- a/framework-docs/modules/ROOT/pages/web/webflux-functional.adoc +++ b/framework-docs/modules/ROOT/pages/web/webflux-functional.adoc @@ -294,7 +294,28 @@ allPartsEvents.windowUntil(PartEvent::isLast) ---- ====== -Note that the body contents of the `PartEvent` objects must be completely consumed, relayed, or released to avoid memory leaks. +NOTE: The body contents of the `PartEvent` objects must be completely consumed, relayed, or released to avoid memory leaks. + +The following shows how to bind request parameters, including an optional `DataBinder` customization: + +[tabs] +====== +Java:: ++ +[source,java] +---- +Pet pet = request.bind(Pet.class, dataBinder -> dataBinder.setAllowedFields("name")); +---- + +Kotlin:: ++ +[source,kotlin] +---- +val pet = request.bind(Pet::class.java, {dataBinder -> dataBinder.setAllowedFields("name")}) +---- +====== + + [[webflux-fn-response]] === ServerResponse diff --git a/framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc b/framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc index 82fb164a949..60e48c69a5e 100644 --- a/framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc +++ b/framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc @@ -184,6 +184,26 @@ val map = request.params() ---- ====== +The following shows how to bind request parameters, including an optional `DataBinder` customization: + +[tabs] +====== +Java:: ++ +[source,java] +---- +Pet pet = request.bind(Pet.class, dataBinder -> dataBinder.setAllowedFields("name")); +---- + +Kotlin:: ++ +[source,kotlin] +---- +val pet = request.bind(Pet::class.java, {dataBinder -> dataBinder.setAllowedFields("name")}) +---- +====== + + [[webmvc-fn-response]] === ServerResponse