]> juplo.de Git - maven-thymeleaf-skin/commitdiff
WIP: proxy
authorKai Moritz <kai@juplo.de>
Thu, 16 Jun 2016 11:56:55 +0000 (13:56 +0200)
committerKai Moritz <kai@juplo.de>
Thu, 16 Jun 2016 11:56:55 +0000 (13:56 +0200)
src/main/java/de/juplo/thymeproxy/Application.java
src/main/java/de/juplo/thymeproxy/ProxyHttpRequestHandler.java
src/main/resources/application.properties

index a12205e2da4cd0da235e6c18f5512a3d4be8fcba..66557b9cb45754129e33fa7b5d9b9e1cecb48046 100644 (file)
@@ -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<String, Object> 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;
   }
 
index 41c3bddf204ffb8c75c11a06e2d3b543cc058e00..2ea7762db5ed2ccec528d679a04e5f84a4794651 100644 (file)
@@ -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);
index 496184b0734d21ddf17beabc8dd696447c24d693..0a4144f5f044565f1bd623dc5c68b352fa938a0d 100644 (file)
@@ -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