Configured httpresource to proxy all requests to the configured origin proxy
authorKai Moritz <kai@juplo.de>
Fri, 8 Jan 2021 14:05:45 +0000 (15:05 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 16 Jan 2021 14:37:10 +0000 (15:37 +0100)
pom.xml
src/main/java/de/juplo/demo/httpresources/HttpResourcesDemoApplication.java
src/main/resources/application.properties

diff --git a/pom.xml b/pom.xml
index 1b7fcd2..3cd520c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                        <artifactId>spring-boot-starter-web</artifactId>
                </dependency>
                <dependency>
-                       <groupId>org.springframework.boot</groupId>
-                       <artifactId>spring-boot-starter-thymeleaf</artifactId>
+                       <groupId>de.juplo</groupId>
+                       <artifactId>http-resources</artifactId>
+                       <version>2.0.0</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.httpcomponents</groupId>
+                       <artifactId>httpclient</artifactId>
                </dependency>
 
                <dependency>
index 71b8a6d..aec1079 100644 (file)
@@ -2,10 +2,21 @@ package de.juplo.demo.httpresources;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.client.ClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+
 
 @SpringBootApplication
 public class HttpResourcesDemoApplication
 {
+       @Bean
+       public ClientHttpRequestFactory clientHttpRequestFactory()
+       {
+               return new HttpComponentsClientHttpRequestFactory();
+       }
+
+
        public static void main(String[] args)
        {
                SpringApplication.run(HttpResourcesDemoApplication.class, args);
index 8b13789..c1ebc61 100644 (file)
@@ -1 +1,7 @@
-
+server.port=8080
+origin=http://localhost:8888
+juplo.http-resources.protocol-resolver.enabled=true
+spring.resources.static-locations=classpath:/overwrite/,${origin},classpath:/fallback/
+spring.thymeleaf.prefix=/
+spring.thymeleaf.suffix=.html
+logging.level.de.juplo=DEBUG