read file from classpath

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

read file from classpath

chaij
Is possible to read file using Camel from classpath? This file lives in the bundle.

I have a xml file and want to read it in using file component and then convert it to Document.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: read file from classpath

Gnanaguru S
Yes. You should be able to !

I think you can use Camel simple and call the file like this classpath:resource:/path/filename.ext

Give it a shot. But go through simple component first, you will get some idea.

Cheers
Guru
Reply | Threaded
Open this post in threaded view
|

Re: read file from classpath

hadrian
In reply to this post by chaij
Jin,

Is the file in a different bundle? You have to add your resource bundle as a
dependency.

Hadrian


On Thursday 03 April 2014 01:07:53 chaij wrote:

> Is possible to read file using Camel from classpath? This file lives in the
> bundle.
>
> I have a xml file and want to read it in using file component and then
> convert it to Document.
>
> Thanks!
>
>
>
> --
> View this message in context:
>  http://camel.465427.n5.nabble.com/read-file-from-classpath-tp5749705.html
>  Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: read file from classpath

chaij
It is in the same bundle.. I was able to do it like this:

                        <camel:from uri="timer://loadSAMLToken?repeatCount=1" />
                        <camel:setBody>
                                <camel:simple>resource:classpath:cms-files/saml.xml</camel:simple>
                        </camel:setBody>


Thanks!
Jin