質問

The FOP component doesn't appear to be propagating headers. In the route below, headers are available to the XSLT component and it does pass them through the other side. But after fop, they're all gone.

Is this a bug?. Can someone suggest a workaround?

<route>
    <from uri="direct:render"/>
    <to uri="xslt:file:{{rootDir}}/Report.xsl"/>
    <to uri="fop:application/pdf"/>
    <log message="Headers after fop ${headers}"/>
</route>

thanks

役に立ちましたか?

解決

OK, my workaround is as follows:

<route>
    <from uri="direct:render"/>

    <!-- Retain header value in property before it's lost -->
    <setProperty propertyName="lostHeader">
        <simple>${header.lostHeader}</simple>
    </setProperty>

    <to uri="xslt:file:{{rootDir}}/Report.xsl"/>
    <to uri="fop:application/pdf"/>

    <!-- Restore it again -->
    <setHeader headerName="lostHeader">
        <simple>${property.lostHeader}</simple>
    </setHeader>

    <log message="Headers after fop ${headers}"/>

    <!-- Now it's available again here -->
    <to uri="jms:jms/happyQueue"/>
</route>

As I said, it's a workaround and, of course, you'd have to handle any headers you need individually. I will probably log a jira bug on the fop component.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top