1 package de.juplo.thymeproxy;
3 import java.util.HashMap;
5 import org.apache.http.impl.client.CloseableHttpClient;
6 import org.springframework.boot.SpringApplication;
7 import org.springframework.boot.autoconfigure.SpringBootApplication;
8 import org.springframework.context.annotation.Bean;
9 import org.springframework.core.Ordered;
10 import org.springframework.core.env.Environment;
13 @SpringBootApplication
14 public class Application
17 public RegexUrlHandlerMapping proxiedHandlerMapping(
18 ProxyHttpRequestHandler handler
21 RegexUrlHandlerMapping mapping = new RegexUrlHandlerMapping();
22 mapping.setOrder(Ordered.HIGHEST_PRECEDENCE);
23 Map<String, Object> mappings = new HashMap<>();
24 mappings.put(".*\\.html$", handler);
25 mappings.put("/css/.+", handler);
26 mappings.put("/js/.+", handler);
27 mappings.put("/fonts/.+", handler);
28 mappings.put("/.+/", handler);
29 mapping.setUrlMap(mappings);
34 public ProxyHttpRequestHandler proxiedRequestHandler(
35 CloseableHttpClient client,
39 ProxyHttpRequestHandler handler = new ProxyHttpRequestHandler();
40 handler.setClient(client);
41 handler.setOrigin(env.getProperty("thymeproxy.origin"));
42 handler.setTtl(30000l);
47 public static void main(String[] args)
49 SpringApplication.run(Application.class, args);