我有一个骆驼路线,它有一个步骤调用子路线将正文的文本部分转换为 PDF。不幸的camel-pdf是不保留标题。有没有办法在不丢失当前交换的情况下获得子路由的价值?
子路由
from("seda:generate-pdf")
// Back up the original in a header
.setHeader("original", body())
// Create the PDF
.to("pdf:create?textProcessingFactory=autoFormatting")
// UHOH! All my headers are gone :(
// Set the PDF as the header for the doc server
.setHeader("pdf", body())
// Move the indicator back to the body
.setBody(header("original")) // <-- this no longer exists
Run Code Online (Sandbox Code Playgroud)
主要路线
// Snip
// Unmarshal into Java
.unmarshal().json(JsonLibrary.Gson, MyReportContainingText.class)
// Call sub-route to generate the PDF
.inOut("seda:generate-pdf")
// UHOH! All my headers are gone :(
// Snip
Run Code Online (Sandbox Code Playgroud)
当您从一个路由传递到另一个路由时,将它们保存为交换属性,而不是在标题中保存可以删除的内容。例如:
.setProperty("pdf", body())
.setProperty("pdf", simple("${body}")
Run Code Online (Sandbox Code Playgroud)
只要交换存在,交换财产就存在。
| 归档时间: |
|
| 查看次数: |
5519 次 |
| 最近记录: |