33.5. サンプル
サンプルの例は以下のとおりです。
from("activemq:My.Queue"). to("jslt:com/acme/MyResponse.json");
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");
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");
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");
from("direct:in").
setHeader("CamelJsltString").constant(".published").
to("jslt:dummy?allowTemplateFromHeader=true");
交換プロパティーを jslt 式に渡すには、次のようにします。
from("direct:in"). to("jslt:com/acme/MyResponse.json?allowContextMapAll=true");
from("direct:in").
to("jslt:com/acme/MyResponse.json?allowContextMapAll=true");