1 package net.technearts.rip;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.net.URISyntaxException;
6
7 import freemarker.template.Configuration;
8 import freemarker.template.TemplateExceptionHandler;
9
10 public class FreemarkerConfiguration extends Configuration {
11 public static Configuration getDefaultConfiguration() {
12 return new FreemarkerConfiguration();
13 }
14
15 private FreemarkerConfiguration() {
16 super(VERSION_2_3_26);
17 setDefaultEncoding("UTF-8");
18 setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
19 setLogTemplateExceptions(false);
20 try {
21 File f;
22 try {
23 f = new File(RipResponseBuilder.class.getResource("/").toURI());
24 } catch (final URISyntaxException e) {
25 f = new File(RipResponseBuilder.class.getResource("/").getPath());
26 }
27 setDirectoryForTemplateLoading(f);
28 } catch (final IOException e) {
29
30 e.printStackTrace();
31 }
32 }
33 }