Velocity, Freemarker, Japid, Rythm, any other? What i am looking for is a solution similar to what JSP provides in servlet environment. It should be a form of ViewProcessor implementation, but working on standalone embedded Grizzly deployment(NIO architecture).

3

There are 3 answers

0
Martin Matula On BEST ANSWER

Jersey has support for freemarker templates - see jersey-freemarker module on maven. It works with any container (i.e. is not depending on servlet). There is also freemarker sample in Jersey workspace that shows how to use it - see here.

0
Wolfgang Fahl On

The Open Source Project

http://www.bitplan.com/index.php/SimpleRest

supplies a TemplateResource base class which will do most of the "heavy lifting" to make Jersey, Grizzly and the Rythm template engine work together nicely.

0
Gelin Luo On

I think all the template engines you listed could be used in an independent environment. Specifically for Rythm (coz I am the author of this stuff), it loads template files from different sources:

  1. from the String content supplied:

    String result = Rythm.render("hello @who", "world");

  2. from a file found from the rythm.root setting:

    String result = Rythm.render("helloWorld.html", "world");

  3. from a file found from the class path if you have no rythm.root setup

It just doesn't depend on any servlet container, so you are free to use it as long as you have JRE. Be sure to set rythm.noFileWrite to true if you want to use it in GAE where no file write is allowed.