Java Code Examples for org.rapidoid.setup.My#templatesPath()

The following examples show how to use org.rapidoid.setup.My#templatesPath() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Test
public void testRendering() {
	My.templatesPath("view-rendering");

	JMustacheViewResolver viewResolver = Integrate.jMustacheViewResolver();
	viewResolver.setCustomizer(compiler -> compiler.defaultValue("DEFAULT"));

	My.viewResolver(viewResolver);

	On.get("/").view("mtmpl").mvc((req, resp) -> {
		resp.model("y", "bar");
		return U.map("x", "foo");
	});

	getReq("/");
}
 
Example 2
@Test
public void testRendering() {
	My.templatesPath("view-rendering");

	MustacheJavaViewResolver viewResolver = Integrate.mustacheJavaViewResolver();

	viewResolver.setCustomizer(compiler -> {

		compiler.setObjectHandler(new ReflectionObjectHandler() {
			@Override
			public String stringify(Object object) {
				return "[" + object + "]";
			}
		});

		return compiler;
	});

	My.viewResolver(viewResolver);

	On.get("/").view("mtmpl").mvc((req, resp) -> {
		resp.model("y", "bar");
		return U.map("x", "foo");
	});

	getReq("/");
}
 
Example 3
Source Project: rapidoid   File: HttpTemplatesPathTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testTemplatesPath3() {
	My.templatesPath("test-templates");
	eq(App.custom().templatesPath(), U.array("test-templates"));
	setupAndTest();
}