Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top