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

The following examples show how to use org.rapidoid.setup.My#templatesPath() . 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
Source File: JMustacheViewResolverTest.java    From rapidoid with Apache License 2.0 6 votes vote down vote up
@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
Source File: MustacheJavaViewResolverTest.java    From rapidoid with Apache License 2.0 5 votes vote down vote up
@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 File: HttpTemplatesPathTest.java    From rapidoid with 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();
}