314.3. 使用 Spark 语法的路径

path 选项使用 Spark REST 语法来定义,您可以在其中使用对参数和 splat 的支持来定义 REST 上下文路径。如需更多相关信息,请参阅 Spark Java Route 文档。

以下是使用固定路径的 Camel 路由

from("spark-rest:get:hello")
  .transform().constant("Bye World");

以下路由使用了参数,该参数映射到带有键 "me" 的 Camel 标头。

from("spark-rest:get:hello/:me")
  .transform().simple("Bye ${header.me}");