X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fthymeproxy%2FApplication.java;h=03b106f600e695f69975d4f1a90c767a8cf516c5;hb=91aa988e329618f6233b2b2f6394d4948622f4cc;hp=eb2ddbb4f55d1f130fe50dac960c3c8442ba3e3a;hpb=bdb1a080e3a4c02849ff5d0ce9e78ab376393afe;p=maven-thymeleaf-skin diff --git a/src/main/java/de/juplo/thymeproxy/Application.java b/src/main/java/de/juplo/thymeproxy/Application.java index eb2ddbb..03b106f 100644 --- a/src/main/java/de/juplo/thymeproxy/Application.java +++ b/src/main/java/de/juplo/thymeproxy/Application.java @@ -2,6 +2,7 @@ package de.juplo.thymeproxy; import de.juplo.thymeleaf.JuploDialect; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import org.apache.http.impl.client.CloseableHttpClient; import org.springframework.boot.SpringApplication; @@ -9,14 +10,18 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.core.Ordered; import org.springframework.core.env.Environment; +import org.springframework.web.servlet.View; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.mvc.UrlFilenameViewController; import org.thymeleaf.resourceresolver.IResourceResolver; import org.thymeleaf.resourceresolver.UrlResourceResolver; +import org.thymeleaf.spring4.view.ThymeleafViewResolver; import org.thymeleaf.templateresolver.TemplateResolver; @SpringBootApplication -public class Application +public class Application extends WebMvcConfigurerAdapter { @Bean public RegexUrlHandlerMapping proxiedHandlerMapping( @@ -100,6 +105,19 @@ public class Application return new JuploDialect(); } + @Bean + public View error(ThymeleafViewResolver resolver) throws Exception + { + return resolver.resolveViewName("templates/500", Locale.getDefault()); + } + + + @Override + public void addViewControllers(ViewControllerRegistry registry) + { + registry.addViewController("/").setViewName("forward:index.html"); + } + public static void main(String[] args) {