2

In Apache Camel, is it possible to use template groups (c.f. https://theantlrguy.atlassian.net/wiki/display/ST4/Group+file+syntax) using the string-template component ?

I would like to load a template group file to be able to used the named templates defined there and use them in the template file refered to by a string-template endpoint.

There does not seem to be any means to configure the string-template endpoint or component to define where to load a group file.

Any ideas on whether this is possible or not and if so how ?

b_habegger
  • 309
  • 2
  • 13

1 Answers1

1

Is there a reason for needing the template groups and ST4? According to the String-Template Component page:

string-template:templateName[?options]

Where templateName is the classpath-local URI of the template to invoke; or the complete URL of the remote template.

I would think you could put all your template files in the same folder and treat that as your group.

Peter Keller
  • 7,526
  • 2
  • 26
  • 29
Dakota Brown
  • 730
  • 7
  • 20
  • Yes there is a reason... otherwise why would I ask ? Its to keep my code clean an prevent duplication. Also I may want to use the same groups in different template endpoints. Anyway, I've tried what you said and didn't work for me. Maybe I got it wrong, if you have a working example its welcome... – b_habegger Aug 12 '14 at 23:32
  • I get the string-template usage to prevent duplication, but the concept of a group isn't necessary when you can put them in a folder and reference them by path. I'm at work so I can't get an example together right now. I will try to get a working example when I get home around 6 EST. – Dakota Brown Aug 13 '14 at 12:34