use of org.thymeleaf.templateresolver.AbstractTemplateResolver in project cas by apereo.
the class CasCoreViewsConfiguration method chainingTemplateViewResolver.
@Bean
public AbstractTemplateResolver chainingTemplateViewResolver() {
final ChainingTemplateViewResolver chain = new ChainingTemplateViewResolver();
casProperties.getView().getTemplatePrefixes().forEach(Unchecked.consumer(prefix -> {
final String prefixPath = ResourceUtils.getFile(prefix).getCanonicalPath();
final String viewPath = StringUtils.appendIfMissing(prefixPath, "/");
final ThemeFileTemplateResolver theme = new ThemeFileTemplateResolver(casProperties);
configureTemplateViewResolver(theme);
theme.setPrefix(viewPath + "themes/%s/");
chain.addResolver(theme);
final FileTemplateResolver file = new FileTemplateResolver();
configureTemplateViewResolver(file);
file.setPrefix(viewPath);
chain.addResolver(file);
}));
return chain;
}
Aggregations