From d4ff7118b2ce371b0ae0a14aa41744cdbcb221be Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Thu, 16 Mar 2023 16:34:41 -0300 Subject: [PATCH] Explain why `@PathParam` may be optional in this case - Fixes #31907 --- docs/src/main/asciidoc/qute.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/qute.adoc b/docs/src/main/asciidoc/qute.adoc index 1f5b35e82bf44..ce7f5b22a71ba 100644 --- a/docs/src/main/asciidoc/qute.adoc +++ b/docs/src/main/asciidoc/qute.adoc @@ -282,7 +282,7 @@ public class ItemResource { @GET @Path("{id}") @Produces(MediaType.TEXT_HTML) - public TemplateInstance get(Integer id) { + public TemplateInstance get(@PathParam("id") Integer id) { return Templates.item(service.findItem(id)); <2> } } @@ -290,6 +290,8 @@ public class ItemResource { <1> Declare a method that gives us a `TemplateInstance` for `templates/ItemResource/item.html` and declare its `Item item` parameter so we can validate the template. <2> Make the `Item` object accessible in the template. +NOTE: When the `--parameters` compiler argument is enabled, RESTEasy Reactive may infer the parameter names from the method argument names, making the `@PathParam("id")` annotation optional in this case. + === Template parameter declaration inside the template itself Alternatively, you can declare your template parameters in the template file itself.