You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andreu Font Bardolet (Jira)" <ji...@apache.org> on 2020/05/19 09:32:00 UTC

[jira] [Updated] (CAMEL-15087) toD doesn't resolve ${headers} if they come from a propertyPlaceholders

     [ https://issues.apache.org/jira/browse/CAMEL-15087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreu Font Bardolet updated CAMEL-15087:
-----------------------------------------
    Description: 
From camel 3.1 and up, I have detected that <doD/> doesn't resolve variables in propertyPlaceholders.

For example:

if i have an etc/uri.properties with:

{{example=[http://$|http://%24/]{header.url}/}}

 

And in camel Context xml:

{{...}}

{{<camelContext id="example" xmlns="http://camel.apache.org/schema/spring">}}{{}}
   <propertyPlaceholder id="myProperties" location="classpath:etc/uri.properties"/>
   <route id="test">
     <from uri="timer:hello?period=3000"/>
     <setHeader name="url"><constant>www.google.es</constant></setHeader>
     <log message="{{{{example}}}}"/>
     {color:#4c9aff}<!-- It logs: [http://www.google.es/] -->{color}
     <toD uri="{{{{example}}"}}/>
     {color:#4c9aff}<!-- It resolves:  [http://$|http://%24/]{header.url}/ instead of [http://www.google.es/] -->{color}

{{  </route>}}
 {{</camelContext>}}
  
  
 {{But if i do a kind of a workarround like this, it works:}}
 {{...}}

{{<camelContext id="example" xmlns="http://camel.apache.org/schema/spring">}}{{}}
   <propertyPlaceholder id="myProperties" location="classpath:etc/uri.properties"/>
   <route id="test">
     <from uri="timer:hello?period=3000"/>
     <setHeader name="url"><constant>www.google.es</constant></setHeader>
     <setHeader name="workarround"><simple>{{{{example}}}}</simple></setHeader>
     <toD uri="${headers.workarround}/>
     {color:#4c9aff}<!-- It resolves:  [http://www.google.es/] -->{color}

{{  </route>}}
 {{</camelContext>}}
  

  was:
From camel 3.1 and up, I have detected that <doD/> doesn't resolve variables in propertyPlaceholders.

For example:

if i have an etc/uri.properties with:

{{example=http://${header.url}/}}

 

And in camel Context xml:

{{...}}

{{<camelContext id="example" xmlns="http://camel.apache.org/schema/spring">}}{{}}
  <propertyPlaceholder id="myProperties" location="classpath:etc/uri.properties"/>
  <route id="test">
    <from uri="timer:hello?period=3000"/>
    <setHeader name="url"><constant>www.google.es</constant></setHeader>
    <log message="\{{example}}"/>
    <!-- It logs: [http://www.google.es/] -->
    <toD uri="\{{example}}/>
    <!-- It resolves:  http://${header.url}/ instead of [http://www.google.es/] -->{{  </route>}}
{{</camelContext>}}
 
 
{{But if i do a kind of a workarround like this, it works:}}
{{...}}

{{<camelContext id="example" xmlns="http://camel.apache.org/schema/spring">}}{{}}
  <propertyPlaceholder id="myProperties" location="classpath:etc/uri.properties"/>
  <route id="test">
    <from uri="timer:hello?period=3000"/>
    <setHeader name="url"><constant>www.google.es</constant></setHeader>
    <setHeader name="workarround"><simple>\{{example}}</simple></setHeader>
    <toD uri="${headers.workarround}/>
    <!-- It resolves:  [http://www.google.es/] -->{{  </route>}}
{{</camelContext>}}
 


> toD doesn't resolve ${headers} if they come from a propertyPlaceholders
> -----------------------------------------------------------------------
>
>                 Key: CAMEL-15087
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15087
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 3.1.0, 3.2.0, 3.3.0
>            Reporter: Andreu Font Bardolet
>            Priority: Major
>
> From camel 3.1 and up, I have detected that <doD/> doesn't resolve variables in propertyPlaceholders.
> For example:
> if i have an etc/uri.properties with:
> {{example=[http://$|http://%24/]{header.url}/}}
>  
> And in camel Context xml:
> {{...}}
> {{<camelContext id="example" xmlns="http://camel.apache.org/schema/spring">}}{{}}
>    <propertyPlaceholder id="myProperties" location="classpath:etc/uri.properties"/>
>    <route id="test">
>      <from uri="timer:hello?period=3000"/>
>      <setHeader name="url"><constant>www.google.es</constant></setHeader>
>      <log message="{{{{example}}}}"/>
>      {color:#4c9aff}<!-- It logs: [http://www.google.es/] -->{color}
>      <toD uri="{{{{example}}"}}/>
>      {color:#4c9aff}<!-- It resolves:  [http://$|http://%24/]{header.url}/ instead of [http://www.google.es/] -->{color}
> {{  </route>}}
>  {{</camelContext>}}
>   
>   
>  {{But if i do a kind of a workarround like this, it works:}}
>  {{...}}
> {{<camelContext id="example" xmlns="http://camel.apache.org/schema/spring">}}{{}}
>    <propertyPlaceholder id="myProperties" location="classpath:etc/uri.properties"/>
>    <route id="test">
>      <from uri="timer:hello?period=3000"/>
>      <setHeader name="url"><constant>www.google.es</constant></setHeader>
>      <setHeader name="workarround"><simple>{{{{example}}}}</simple></setHeader>
>      <toD uri="${headers.workarround}/>
>      {color:#4c9aff}<!-- It resolves:  [http://www.google.es/] -->{color}
> {{  </route>}}
>  {{</camelContext>}}
>   



--
This message was sent by Atlassian Jira
(v8.3.4#803005)