use of org.thymeleaf.postprocessor.PostProcessor in project cas by apereo.
the class CasThemesConfiguration method registeredServiceViewResolver.
@Bean
public ViewResolver registeredServiceViewResolver() {
final RegisteredServiceThemeBasedViewResolver r = new RegisteredServiceThemeBasedViewResolver(servicesManager, argumentExtractors, thymeleafProperties.getPrefix(), thymeleafProperties.getSuffix());
r.setApplicationContext(this.thymeleafViewResolver.getApplicationContext());
r.setCache(this.thymeleafProperties.isCache());
if (!r.isCache()) {
r.setCacheLimit(0);
}
r.setCacheUnresolved(this.thymeleafViewResolver.isCacheUnresolved());
r.setCharacterEncoding(this.thymeleafViewResolver.getCharacterEncoding());
r.setContentType(this.thymeleafViewResolver.getContentType());
r.setExcludedViewNames(this.thymeleafViewResolver.getExcludedViewNames());
r.setOrder(this.thymeleafViewResolver.getOrder());
r.setRedirectContextRelative(this.thymeleafViewResolver.isRedirectContextRelative());
r.setRedirectHttp10Compatible(this.thymeleafViewResolver.isRedirectHttp10Compatible());
r.setStaticVariables(this.thymeleafViewResolver.getStaticVariables());
final SpringTemplateEngine engine = SpringTemplateEngine.class.cast(this.thymeleafViewResolver.getTemplateEngine());
engine.addDialect(new IPostProcessorDialect() {
@Override
public int getDialectPostProcessorPrecedence() {
return Integer.MAX_VALUE;
}
@Override
public Set<IPostProcessor> getPostProcessors() {
return Collections.singleton(new PostProcessor(TemplateMode.parse(thymeleafProperties.getMode()), CasThymeleafOutputTemplateHandler.class, Integer.MAX_VALUE));
}
@Override
public String getName() {
return CasThymeleafOutputTemplateHandler.class.getSimpleName();
}
});
r.setTemplateEngine(engine);
r.setViewNames(this.thymeleafViewResolver.getViewNames());
return r;
}
Aggregations