rocker

rocker

Java 8 optimized, memory efficient, speedy template engine producing statically typed, plain java objects.

Rocker is a Java 8 optimized (runtime compat with 6+), near zero-copy rendering, speedy template engine that produces statically typed, plain java object templates that are compiled along with the rest of your project.

exports

dependency

<dependency>
 <groupId>org.jooby</groupId>
 <artifactId>jooby-rocker</artifactId>
 <version>1.5.1</version>
</dependency>

usage

{
  use(new Rockerby());

  // Rocker API:
  get("/", () -> views.index.template("Rocker"));
}

rocker idioms

Rocker support two flavors.

The static, efficient and type-safe flavor:

{
  use(new Rockerby());

  get("/", () -> views.index.template("Rocker"));
}

Or the dynamic flavor is available via View objects:

{
  use(new Rockerby());

  get("/", () -> Results.html("views/index").put("message", "Rocker"));
}

which is syntax sugar for:

{
  use(new Rockerby());

  get("/", () -> {
    return Rocker.template("views/index.rocker.html").bind("message", "Rocker");
  });

}

code generation

maven

We do provide code generation via Maven profile. All you have to do is to write a rocker.activator file inside the src/etc folder. File presence triggers generation of source code.

gradle

Please refer to Rocker documentation for Gradle.

hot reload

You don’t need Rocker hot reload as long as you start your application in development with jooby:run. Because jooby:run already restart the application on class changes.

That’s all folks!!