61.7. Samples
示例示例如下。
from("activemq:My.Queue").
to("jslt:com/acme/MyResponse.json");
和基于文件的资源:
from("activemq:My.Queue").
to("jslt:file://myfolder/MyResponse.json?contentCache=true").
to("activemq:Another.Queue");
您还可以指定组件应该通过标头动态使用的 JSLT 表达式,例如:
from("direct:in").
setHeader("CamelJsltResourceUri").constant("path/to/my/spec.json").
to("jslt:dummy?allowTemplateFromHeader=true");
或者通过标头发送整个 jslt 表达式:(用于查询)
from("direct:in").
setHeader("CamelJsltString").constant(".published").
to("jslt:dummy?allowTemplateFromHeader=true");
按如下所示将交换属性传递给 jslt 表达式
from("direct:in").
to("jslt:com/acme/MyResponse.json?allowContextMapAll=true");