i have an expression bellow to read a file from resources :
#[Thread.currentThread().getContextClassLoader().getResourceAsStream('abc.txt')]
it worked fine, but i want to use a variable like this one:
#[Thread.currentThread().getContextClassLoader().getResourceAsStream(flowVars['fileName'])]
it does not work,
Thanks for helps.
resolved
flowVars.filename
instead of flowVars['fileName']
it worked, but i can't get it, i use logger with this MEL #[flowVars['filename']]
and it work too but in the second MEL it failed. 1) You are using a different case with the two different approaches. Variable names are case sensitive.
2) Just use a FileInputStream:
#[new FileInputStream("path")]
Or even better maybe to use the File transport/Mule Requester Module.
试试这个,用变量名代替关键字“ flowVars”
#[Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.