Camel replace all CRLF with LF using Simple DSL

最后都变了- 提交于 2020-01-03 02:20:27

问题


I am trying to replace the CRLF of the input data with LF but this is breaking the route. My code is as shown below

from(fromEndpoint)
    .convertBodyTo(byte[].class, "iso-8859-1")
    .setBody(simple("body.replaceAll(\r\n, \n)"))....

if I take the setbody out it works perfect. I just want platform dependent line feeds

Any ideas what I am doing wrong?

Thanks


回答1:


solved with this

from(fromEndpoint)
    .convertBodyTo(byte[].class, "iso-8859-1")
    .setBody(body().regexReplaceAll("\\r\\n", "\\\n"))


来源:https://stackoverflow.com/questions/18508716/camel-replace-all-crlf-with-lf-using-simple-dsl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!