Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get File Name without extension in Camel

Tags:

apache-camel

Hi Does anyone know how to get a file name without extension in camel. using spring xml.

I know ${header.CamelFileNameOnly} will give the full file name like "test.txt".

I would just like to get the name "test" and need to use this name in somewhere else, does anyone know how to do it ?

like image 463
Lisa Avatar asked Dec 26 '22 18:12

Lisa


1 Answers

Use the file-expression language. Your route shall be something like

<camel:route>
    <camel:from uri="file://input/orders" />
    <camel:setHeader headerName="FileNameWithoutExtension">
        <camel:simple>${file:onlyname.noext}</camel:simple>
    </camel:setHeader>
</camel:route>
like image 187
Hussain Pirosha Avatar answered Jan 05 '23 17:01

Hussain Pirosha