Skip to content

Commit

Permalink
Update javadoc - Route, Param, Header
Browse files Browse the repository at this point in the history
  • Loading branch information
mkouba committed Jul 21, 2020
1 parent 80db54d commit 53ad1e8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* Identifies a route method parameter that should be injected with a value returned from
* {@link HttpServerRequest#getHeader(String)}.
* <p>
* The parameter type must be {@link String} or {@code Optional<String>}, otherwise the build fails.
* The parameter type must be {@link String}, {@code java.util.Optional<String>} or {@code java.util.List<String>}, otherwise
* the build fails.
*
* @see HttpServerRequest#getHeader(String)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* Identifies a route method parameter that should be injected with a value returned from
* {@link HttpServerRequest#getParam(String)}.
* <p>
* The parameter type must be {@link String} or {@code Optional<String>}, otherwise the build fails.
* The parameter type must be {@link String}, {@code java.util.Optional<String>} or {@code java.util.List<String>}, otherwise
* the build fails.
*
* @see HttpServerRequest#getParam(String)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,47 @@
* <li>{@code io.vertx.reactivex.core.http.HttpServerRequest}</li>
* <li>{@code io.vertx.reactivex.core.http.HttpServerResponse}</li>
* </ul>
* Furthermore, it is possible to inject the request parameters into a method parameter annotated with
* {@link io.quarkus.vertx.web.Param}:
*
* <pre>
* <code>
* class Routes {
* {@literal @Route}
* String hello({@literal @Param Optional<String>} name) {
* return "Hello " + name.orElse("world");
* }
* }
* </code>
* </pre>
*
* The request headers can be injected into a method parameter annotated with {@link io.quarkus.vertx.web.Header}:
*
* <pre>
* <code>
* class Routes {
* {@literal @Route}
* String helloFromHeader({@literal @Header("My-Header")} String header) {
* return "Hello " + header;
* }
* }
* </code>
* </pre>
*
* The request body can be injected into a method parameter annotated with {@link io.quarkus.vertx.web.Body}:
*
* <pre>
* <code>
* class Routes {
* {@literal @Route(produces = "application/json")}
* Person updatePerson({@literal @Body} Person person) {
* person.setName("Bob");
* return person;
* }
* }
* </code>
* </pre>
*
* If the annotated method returns {@code void} then it has to accept at least one argument.
* If the annotated method does not return {@code void} then the arguments are optional.
* <p>
Expand Down

0 comments on commit 53ad1e8

Please sign in to comment.