camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Langevin" <daniel.lange...@shq.gouv.qc.ca>
Subject Convertbody with dynamic Charset
Date Fri, 12 Jan 2018 15:23:08 GMT
Hi,

i try to use convertBody to and pass the charset dynamically.


i try:
#1
<setProperty propertyName="mailCharSet"><groovy> ...... retrieve charSet BodyPart
from mail</groovy></setProperty> 
 <convertBodyTo type="java.lang.String" charset="${property.mailCharSet}"></convertBodyTo>

but receive error 
Caused by: java.nio.charset.IllegalCharsetNameException: ${property.mailCharSet}

#2
<setProperty propertyName="mailCharSet"><groovy> ...... retrieve charSet BodyPart
from mail</groovy></setProperty> 
<convertBodyTo type="java.lang.String" charset="{{mailCharSet}}"></convertBodyTo>

but receive error
Caused by: java.lang.IllegalArgumentException: Property with key [mailCharSet] not found in
properties from text: {{mailCharSet}}
..... is searching  property key mailCharSet from my property folder., but this one cannot
be Dynamic !

#3
add this property key in my property file
charset_UTF-8=utf-8

<setProperty propertyName="mailCharSet"><constant>UTF-8</constant></setProperty>

<convertBodyTo type="java.lang.String" charset="{{charset_${property.mailCharSet}}}"></convertBodyTo>

but receive error
Caused by: java.lang.IllegalArgumentException: Property with key [charset_${property.mailCharSet]
not found in properties from text: {{charset_${property.mailCharSet}}}
... substitution doesn't work !!?!! it supposed to search charset_UTF-8 into property folder
!

There is a way to achieve that ?  Someone have an idea !


Daniel







"Le présent courriel peut contenir des renseignements confidentiels et ne s'adresse qu'au
destinataire dont le nom apparaît ci-dessus. Si ce courriel vous est parvenu par mégarde,
veuillez le supprimer et nous en aviser aussitôt."

Mime
View raw message