Jan Bednar created CAMEL-12486:
----------------------------------

             Summary: Placeholders are not resolved in Simple language while 
using resource: prefix
                 Key: CAMEL-12486
                 URL: https://issues.apache.org/jira/browse/CAMEL-12486
             Project: Camel
          Issue Type: Wish
          Components: camel-core
            Reporter: Jan Bednar
         Attachments: 
Allow_dynamic_resource_loading_in_simple_language_failing_test.patch

This behavior was found in question 
https://stackoverflow.com/questions/50063874/load-camels-body-dynamically-depending-on-header

This is because expression with prefix *resource* is resolved in 
LanguageSupport#loadResource before property placeholders are resolved. This is 
reasonable, as placeholders are resolved in expression loaded from file. But it 
prevents from dynamic resource loading.

It would be nice to allow property resolution in resource in this way
{code:java}
.transform().simple("resource:classpath:${header.myFileName}"){code}
I would expect this behavior:
 # Resolve placeholders in expression (now missing)
 # Load String from resource as new expression (exists)
 # Resolve placeholders in new expression (exists)

I have tried to create patch for *SimpleLanguage*, but I failed. Attaching 
patch to *SimpleResourceTest* with expected behavior based on master.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to