Search in sources :

Example 1 with TextTemplateRenderingEngine

use of ratpack.groovy.template.internal.TextTemplateRenderingEngine in project ratpack by ratpack.

the class TextTemplateModule method provideGroovyTemplateRenderingEngine.

@Provides
@Singleton
TextTemplateRenderingEngine provideGroovyTemplateRenderingEngine(ServerConfig serverConfig, ExecController execController, ByteBufAllocator bufferAllocator, Config config) {
    String templatesPath = config.getTemplatesPath();
    FileSystemBinding templateDir = serverConfig.getBaseDir().binding(templatesPath);
    if (templateDir == null) {
        throw new IllegalStateException("templatesPath '" + templatesPath + "' is outside the file system binding");
    }
    return new TextTemplateRenderingEngine(bufferAllocator, templateDir, serverConfig.isDevelopment(), config.staticallyCompile);
}
Also used : FileSystemBinding(ratpack.file.FileSystemBinding) TextTemplateRenderingEngine(ratpack.groovy.template.internal.TextTemplateRenderingEngine) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Provides (com.google.inject.Provides)1 Singleton (com.google.inject.Singleton)1 FileSystemBinding (ratpack.file.FileSystemBinding)1 TextTemplateRenderingEngine (ratpack.groovy.template.internal.TextTemplateRenderingEngine)1