Dynamically load template files to Rythm? (without directory setting)

121 Views Asked by At

I want to be able to do something like

// be able to replace this section
Map<String, Object> map = new HashMap<>();
map.put("home.template", "resources"); // foo.html and bar.html (foo invoke bar)
Rythm.init(map);
System.out.println(Rythm.render("foo.html", "World"));

// with this section
Rythm.put("foo.html", fooTemplateStr);//dynamically add/replace foo.html to template repository
Rythm.put("bar.html", barTemplateStr);//dynamically add/replace bar.html to template repository
System.out.println(Rythm.render("foo.html", "World"));

I am building a simple blog engine that allows the user to set/alter the templates via a web interface. But I am required to have the templates fixed in a directory or jar file with Rythm, can I load them dynamically?

1

There are 1 best solutions below