骆驼的自定义 URIReslover
我们正在尝试使用 xsl 将 xml 转换为我们的自定义 xml 格式,使用 Camel 及其开箱即用的 xslt 支持 这是一个示例路线,
<from uri="file://target/inventory/updates?noop=true"/>
<unmarshal>
<csv />
</unmarshal>
<to uri="bean:XMLConverter?method=processCSVInvoice" />
<to uri="xslt:file//target/inventory/updates/xlsconvertor/XMLConverter.xsl"/>
<to uri="file://target/inventory/updates/test?fileName=test11.xml"/>
</route>
我的问题是,当我将此 xls 文件放入类路径中时,camel 很高兴地选择 xls 并按照路线完成工作,但此时我们将 xls 文件放置在类路径之外,就像在文件系统中一样Camel 无法解决这个问题,我们感到震惊,因为使用 xls 的整个目的是从 jar 中取出自定义 xml 格式
作为解决方法,我尝试创建一个 customURLResolver 并尝试使用它,
<from uri="file://target/inventory/updates?noop=true"/>
<unmarshal>
<csv />
</unmarshal>
<to uri="bean:XMLConverter?method=processCSVInvoice" />
<to uri="xslt:file//target/inventory/updates/xlsconvertor/XMLConverter.xsl?uriResolver=customURIResolver"/>
<to uri="file://target/inventory/updates/test?fileName=test11.xml"/>
</route>
但在这种情况下,camel 不是打电话给我的自定义URI解析器 知道如何让 Camel 使用我的自定义 URIResolver 代替其默认解析器
we are trying to use xsl for converting xml to our custom xml format using camel and its out of the box xslt support
here is a sample route
<from uri="file://target/inventory/updates?noop=true"/>
<unmarshal>
<csv />
</unmarshal>
<to uri="bean:XMLConverter?method=processCSVInvoice" />
<to uri="xslt:file//target/inventory/updates/xlsconvertor/XMLConverter.xsl"/>
<to uri="file://target/inventory/updates/test?fileName=test11.xml"/>
</route>
my problem is when i am putting this xls file in the class path camel is happily picking the xls and doing the work as per the route but moment we are placing the xls file out of class path like in a file system camel is unable to resolve this and we are struck as the whole purpose to use xls is to take custom xml formatting out of the jar
as a workaround i tried to create a customURLResolver and than tried to use it as
<from uri="file://target/inventory/updates?noop=true"/>
<unmarshal>
<csv />
</unmarshal>
<to uri="bean:XMLConverter?method=processCSVInvoice" />
<to uri="xslt:file//target/inventory/updates/xlsconvertor/XMLConverter.xsl?uriResolver=customURIResolver"/>
<to uri="file://target/inventory/updates/test?fileName=test11.xml"/>
</route>
but in this case camel is not calling my customURIResolver
any idea how i can make camel to use my custom URIResolver in place of its default resolver
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您很可能应该使用 # 来指示它是对注册表中 bean 的引用。
尝试按如下方式配置 uri:
uriResolver=#customURIResolver
You should most likely use # to indicate its a reference to a bean in the registry.
Try configuring the uri as follows:
uriResolver=#customURIResolver