-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from DieTechniker/generic-routing-handler
generic routing handler
- Loading branch information
Showing
16 changed files
with
908 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
branches: | ||
- 'release/**' | ||
- 'feature/**' | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Release notes | ||
## 1.0.15 | ||
* Upgrade to Spring-Boot 2.7.1 | ||
* Modified GitHub Action to build maven snapshots on published features | ||
* RoutingHandler Refactoring | ||
* Added generic RoutingHandler.handleGenericRequestInternal() to handle GET and POST via Spring RestTemplate including the request body. Legacy RoutingHandler logic is deprecated. | ||
* Rearranged helper bean initialization to configuration | ||
* switched to null checks on http proxy properties | ||
* Added spring-boot-starter-test and hamcrest-all test dependencies | ||
* Moved from org.junit to org.junit.jupiter.api | ||
* Implemented more tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 13 additions & 1 deletion
14
src/main/java/de/tk/opensource/privacyproxy/config/ProviderRequestMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/main/java/de/tk/opensource/privacyproxy/config/proxy/HttpProxyConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/*--- (C) 1999-2021 Techniker Krankenkasse ---*/ | ||
|
||
package de.tk.opensource.privacyproxy.config.proxy; | ||
|
||
import java.net.InetSocketAddress; | ||
import java.net.Proxy; | ||
|
||
import org.apache.http.HttpHost; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.web.client.RestTemplateBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.DependsOn; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
import de.tk.opensource.privacyproxy.util.ProxyHelper; | ||
import de.tk.opensource.privacyproxy.util.ProxyRoutePlanner; | ||
import de.tk.opensource.privacyproxy.util.RestTemplateProxyCustomizer; | ||
|
||
@Configuration | ||
public class HttpProxyConfig { | ||
|
||
@Value("${http.proxyHost:#{null}}") | ||
private String proxyHost; | ||
|
||
@Value("${http.proxyPort:#{null}}") | ||
private Integer proxyPort; | ||
|
||
@Value("${http.nonProxyHosts:#{null}}") | ||
private String nonProxyHosts; | ||
|
||
@Bean | ||
public Proxy proxy() { | ||
if (proxyHost == null || proxyPort == null) { | ||
return Proxy.NO_PROXY; | ||
} else { | ||
return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)); | ||
} | ||
} | ||
|
||
@Bean | ||
public HttpHost httpHost() { | ||
if (proxyHost != null && proxyPort != null) { | ||
return new HttpHost(proxyHost, proxyPort); | ||
} | ||
return null; | ||
} | ||
|
||
@Bean | ||
@DependsOn("proxy") | ||
public ProxyHelper proxyHelper() { | ||
return new ProxyHelper(proxy(), nonProxyHosts); | ||
} | ||
|
||
@Bean | ||
@DependsOn({ "httpHost", "proxyHelper" }) | ||
public ProxyRoutePlanner proxyRoutePlanner() { | ||
return new ProxyRoutePlanner(proxyHelper(), httpHost()); | ||
} | ||
|
||
@Bean | ||
@DependsOn({ "proxyHelper", "proxyRoutePlanner" }) | ||
public RestTemplate restTemplate() { | ||
return new RestTemplateBuilder( | ||
new RestTemplateProxyCustomizer(proxyRoutePlanner(), proxyHelper()) | ||
) | ||
.build(); | ||
} | ||
} | ||
|
||
/*--- Formatiert nach TK Code Konventionen vom 05.03.2002 ---*/ |
Oops, something went wrong.