【问题标题】:Apache Camel FOP component config file locationApache Camel FOP 组件配置文件位置
【发布时间】:2013-02-26 21:34:27
【问题描述】:

我想配置 Apache Camel FOP 组件以使用配置文件(如 here 所述)。似乎 Camel 正在服务器基本路径中寻找文件,因为我遇到了异常:

Caused by: java.io.FileNotFoundException: C:\Users\user\Eclipse\eclipse\src\main\webapp\WEB-INF\fop.xml

我想要的是将配置文件路径与其他配置文件一起存储在类路径中。

这里是骆驼路线:

from("direct:renderer").routeId("direct:renderer")
        .onException(Exception.class)
            // Exception handling
        .end()

        // I want fop.xml config file to be looked for in classpath
        .to("fop:application/pdf?userConfigURL=src/main/webapp/WEB-INF/fop.xml") 
        .setHeader("CamelFileName", simple("${property.job.id}.pdf"))
        .to("file:eiocha/pdf")

我使用的是 2.10.3 版的 Apache Camel

提前致谢

【问题讨论】:

    标签: java apache-camel xsl-fo apache-fop


    【解决方案1】:

    我记录了一张改进 camel-fop 的票,因此可以从类路径和诸如此类的加载 useConfigURL 选项:https://issues.apache.org/jira/browse/CAMEL-6103

    【讨论】:

    • 在哪里可以找到 Resource Helper Api 使用示例?
    【解决方案2】:

    Camel 仅支持配置了起始目录的端点。所以 directoryName 必须是一个目录。

    Reference

    【讨论】:

    • 在我的例子中,eiocha/pdf 是一个目录。文件名使用CamelFileName 标头设置。我理解正确吗?
    • 问题不在于文件组件,它有效。即使 fop 组件在没有 userConfigURL 选项的情况下也能正常工作
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多