Project

General

Profile

« Previous | Next » 

Revision 51001

Additional methods needed by the JRR publishing workflow

View differences:

AppConfig.java
1 1
package eu.dnetlib.parthenos;
2 2

  
3
import freemarker.cache.ClassTemplateLoader;
4
import freemarker.template.TemplateExceptionHandler;
3 5
import org.springframework.boot.web.client.RestTemplateBuilder;
4 6
import org.springframework.context.annotation.Bean;
5 7
import org.springframework.context.annotation.Configuration;
......
36 38
		//TODO: move configuration here from CatalogueRegistrator?
37 39
		return new RestTemplateBuilder().build();
38 40
	}
41

  
42

  
43
	@Bean
44
	public freemarker.template.Configuration freemarkerConfig(){
45
		freemarker.template.Configuration config = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_27);
46
		ClassTemplateLoader ctl = new ClassTemplateLoader(getClass(), "/eu/dnetlib/parthenos/sparql");
47
		config.setDefaultEncoding("UTF-8");
48
		// Sets how errors will appear.
49
		// During web page *development* TemplateExceptionHandler.HTML_DEBUG_HANDLER is better.
50
		config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
51

  
52
		// Don't log exceptions inside FreeMarker that it will thrown at you anyway:
53
		config.setLogTemplateExceptions(false);
54

  
55
		// Wrap unchecked exceptions thrown during template processing into TemplateException-s.
56
		config.setWrapUncheckedExceptions(true);
57

  
58
		return config;
59
	}
39 60
}

Also available in: Unified diff