camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Convertbody with dynamic Charset
Date Fri, 12 Jan 2018 15:51:06 GMT
You cannot make it as a dynamic value computed from each message, but
you can configure it externally using property placeholders. For the
latter read the documentation
http://camel.apache.org/using-propertyplaceholder.html

On Fri, Jan 12, 2018 at 4:23 PM, Daniel Langevin
<daniel.langevin@shq.gouv.qc.ca> wrote:
> 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."



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message