1 package de.juplo.thymeproxy;
3 import java.util.Collections;
4 import org.apache.http.impl.client.CloseableHttpClient;
5 import org.springframework.boot.SpringApplication;
6 import org.springframework.boot.autoconfigure.SpringBootApplication;
7 import org.springframework.context.annotation.Bean;
8 import org.springframework.core.Ordered;
9 import org.springframework.core.env.Environment;
10 import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
13 @SpringBootApplication
14 public class Application
17 public SimpleUrlHandlerMapping proxiedHandlerMapping(
18 ProxyHttpRequestHandler handler
21 RegexUrlHandlerMapping mapping = new RegexUrlHandlerMapping();
22 mapping.setOrder(Ordered.HIGHEST_PRECEDENCE);
23 mapping.setUrlMap(Collections.singletonMap(".*\\.html$", handler));
28 public ProxyHttpRequestHandler proxiedRequestHandler(
29 CloseableHttpClient client,
33 ProxyHttpRequestHandler handler = new ProxyHttpRequestHandler();
34 handler.setClient(client);
35 handler.setOrigin(env.getProperty("thymeproxy.origin"));
36 handler.setTtl(30000l);
41 public static void main(String[] args)
43 SpringApplication.run(Application.class, args);