314.4. 映射到 Camel 消息

Spark Request 对象作为 org.apache.camel.component.sparkrest.SparkMessage,它可以通过 getRequest 方法访问原始 Spark 请求。默认情况下,Spark 正文映射到 Camel 消息正文,任何 HTTP 标头 / Spark 参数都映射到 Camel 消息标头。对 Spark splat 语法有特殊支持,它通过键 splat 映射到 Camel 邮件标题。

例如,以下给定路由在上下文路径中使用 Spark splat (星号符号),我们可作为标头格式访问,以构造响应消息。

from("spark-rest:get:/hello/*/to/*")
  .transform().simple("Bye big ${header.splat[1]} from ${header.splat[0]}");