From: Kai Moritz Date: Thu, 16 Jun 2016 11:56:55 +0000 (+0200) Subject: WIP: proxy X-Git-Tag: alt~29 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=fec87991249472b6c41aef1613fd10917770b3b6;p=maven-thymeleaf-skin WIP: proxy --- diff --git a/src/main/java/de/juplo/thymeproxy/Application.java b/src/main/java/de/juplo/thymeproxy/Application.java index a12205e..66557b9 100644 --- a/src/main/java/de/juplo/thymeproxy/Application.java +++ b/src/main/java/de/juplo/thymeproxy/Application.java @@ -1,6 +1,7 @@ package de.juplo.thymeproxy; -import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import org.apache.http.impl.client.CloseableHttpClient; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -19,7 +20,13 @@ public class Application { RegexUrlHandlerMapping mapping = new RegexUrlHandlerMapping(); mapping.setOrder(Ordered.HIGHEST_PRECEDENCE); - mapping.setUrlMap(Collections.singletonMap(".*\\.html$", handler)); + Map mappings = new HashMap<>(); + mappings.put(".*\\.html$", handler); + mappings.put("/css/.+", handler); + mappings.put("/js/.+", handler); + mappings.put("/fonts/.+", handler); + mappings.put("/.+/", handler); + mapping.setUrlMap(mappings); return mapping; } diff --git a/src/main/java/de/juplo/thymeproxy/ProxyHttpRequestHandler.java b/src/main/java/de/juplo/thymeproxy/ProxyHttpRequestHandler.java index 41c3bdd..2ea7762 100644 --- a/src/main/java/de/juplo/thymeproxy/ProxyHttpRequestHandler.java +++ b/src/main/java/de/juplo/thymeproxy/ProxyHttpRequestHandler.java @@ -102,7 +102,6 @@ public class ProxyHttpRequestHandler } String resource = builder.toString(); - LOG.debug("requesting: {}", resource); CloseableHttpResponse p_response = null; try @@ -113,7 +112,7 @@ public class ProxyHttpRequestHandler StatusLine status = p_response.getStatusLine(); int code = status.getStatusCode(); - LOG.debug("response: {} - {}", code, status.getReasonPhrase()); + LOG.info("{} - {}: {}", code, status.getReasonPhrase(), resource); setCacheControl(computeCacheControl(p_response)); prepareResponse(response); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 496184b..0a4144f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -4,6 +4,6 @@ server.port=@thymeproxy.port@ thymeproxy.ttl=@thymeproxy.ttl@ thymeproxy.origins[0].uri=http://localhost:8080/thymeleaf/ -logging.level.de.juplo=trace +logging.level.de.juplo=info logging.level.org.apache.http=@httpclient.logging.level@ logging.level.org.apache.http.wire=ERROR