This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new e3f7d33 Document usage of dashed query params with platform-http
e3f7d33 is described below
commit e3f7d33e0314ebaa3b61392b0c991793bfbbfc76
Author: James Netherton <[email protected]>
AuthorDate: Tue Jun 1 10:39:48 2021 +0100
Document usage of dashed query params with platform-http
Fixes #2685
---
.../ROOT/pages/reference/extensions/rest.adoc | 34 ++++++++++++++++++++++
.../rest/runtime/src/main/doc/configuration.adoc | 34 ++++++++++++++++++++++
2 files changed, 68 insertions(+)
diff --git a/docs/modules/ROOT/pages/reference/extensions/rest.adoc
b/docs/modules/ROOT/pages/reference/extensions/rest.adoc
index abfe018..aa25eaa 100644
--- a/docs/modules/ROOT/pages/reference/extensions/rest.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/rest.adoc
@@ -45,6 +45,40 @@ Check the xref:user-guide/index.adoc[User guide] for more
information about writ
This extension depends on the
xref:reference/extensions/platform-http.adoc[Platform HTTP] extension
and configures it as the component that provides the REST transport.
+### Path parameters containing special characters with platform-http
+
+When using the `platform-http` REST transport, some characters are not allowed
within path parameter names. This includes the '-' and '$' characters.
+
+In order to make the below example REST `/dashed/param` route work correctly,
a system property is required `io.vertx.web.route.param.extended-pattern=true`.
+
+[source,java]
+----
+import org.apache.camel.builder.RouteBuilder;
+
+public class CamelRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ rest("/api")
+ // Dash '-' is not allowed by default
+ .get("/dashed/param/{my-param}")
+ .route()
+ .setBody(constant("Hello World"))
+ .endRest()
+
+ // The non-dashed path parameter works by default
+ .get("/undashed/param/{myParam}")
+ .route()
+ .setBody(constant("Hello World"))
+ .endRest();
+ }
+}
+----
+
+There is some more background to this in the
https://vertx.io/docs/vertx-web/java/#_capturing_path_parameters[Vert.x Web
documentation].
+
+### Configuring alternate REST transport providers
+
To use another REST transport provider, such as `netty-http` or `servlet`, you
need to add the respective
extension as a dependency to your project and set the provider in your
`RouteBuilder`. E.g. for `servlet`, you'd
have to add the `org.apache.camel.quarkus:camel-quarkus-servlet` dependency
and the set the provider as
diff --git a/extensions/rest/runtime/src/main/doc/configuration.adoc
b/extensions/rest/runtime/src/main/doc/configuration.adoc
index 8cdaa0e..ca2db25 100644
--- a/extensions/rest/runtime/src/main/doc/configuration.adoc
+++ b/extensions/rest/runtime/src/main/doc/configuration.adoc
@@ -1,6 +1,40 @@
This extension depends on the
xref:reference/extensions/platform-http.adoc[Platform HTTP] extension
and configures it as the component that provides the REST transport.
+### Path parameters containing special characters with platform-http
+
+When using the `platform-http` REST transport, some characters are not allowed
within path parameter names. This includes the '-' and '$' characters.
+
+In order to make the below example REST `/dashed/param` route work correctly,
a system property is required `io.vertx.web.route.param.extended-pattern=true`.
+
+[source,java]
+----
+import org.apache.camel.builder.RouteBuilder;
+
+public class CamelRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ rest("/api")
+ // Dash '-' is not allowed by default
+ .get("/dashed/param/{my-param}")
+ .route()
+ .setBody(constant("Hello World"))
+ .endRest()
+
+ // The non-dashed path parameter works by default
+ .get("/undashed/param/{myParam}")
+ .route()
+ .setBody(constant("Hello World"))
+ .endRest();
+ }
+}
+----
+
+There is some more background to this in the
https://vertx.io/docs/vertx-web/java/#_capturing_path_parameters[Vert.x Web
documentation].
+
+### Configuring alternate REST transport providers
+
To use another REST transport provider, such as `netty-http` or `servlet`, you
need to add the respective
extension as a dependency to your project and set the provider in your
`RouteBuilder`. E.g. for `servlet`, you'd
have to add the `org.apache.camel.quarkus:camel-quarkus-servlet` dependency
and the set the provider as