The camel version is 2.15.2
I'm doing now a simple test to see if camel replaces de variables 

public class Item{
   private String description;
   public Item(){}
   public String getDescription(){return this.description;}
   public void setDescription(String description){this.description =
description;}
}

In emailgeneratorbean

Item item = new Item()
item.setDescription("this is a description");
exchange.getIn().setHeader("item", item);

The velocity template 

The item description is ${headers.item.getDescription()}

But ${item.getDescription()} is not been replaced

So i adding Velocity Context.

In emailgeneratorbean

Item item = new Item()
item.setDescription("this is a description");

VelocityContext context = new VelocityContext();
context.put("item", item);

exchange.getIn().setHeader("CamelVelocityContext", context);

The velocity template 

The item description is ${item.getDescription()}

But still is not working

I guess the problem is that if i pass any object (pojo, jpa entitiy) in the
header of the exchange, camel is not replacing it correctly with velocity.
In the las test when i pass the VelocityContext camel is ignoring it.

I read velocity documentation about using objects as variables and the
expresion ${item.getDescription()} is correct as also are correct
$item.description or ${item.description}.

The fact is that camel is not recognosing and object in the header or is not
passing it correctly to velocity, but if i put something like 

exchange.getIn().setHeader("name", "Copernico");

An in template

Hola ${headers.name}

y gets

Hola Copernico









--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Velocity-pass-ArrayList-tp5771027p5771059.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to