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;
12 @SpringBootApplication
13 public class Application
16 public RegexUrlHandlerMapping proxiedHandlerMapping(
17 ProxyHttpRequestHandler handler
20 RegexUrlHandlerMapping mapping = new RegexUrlHandlerMapping();
21 mapping.setOrder(Ordered.HIGHEST_PRECEDENCE);
22 mapping.setUrlMap(Collections.singletonMap(".*\\.html$", handler));
27 public ProxyHttpRequestHandler proxiedRequestHandler(
28 CloseableHttpClient client,
32 ProxyHttpRequestHandler handler = new ProxyHttpRequestHandler();
33 handler.setClient(client);
34 handler.setOrigin(env.getProperty("thymeproxy.origin"));
35 handler.setTtl(30000l);
40 public static void main(String[] args)
42 SpringApplication.run(Application.class, args);