Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
* release/1.2.0:
  release version 1.2.0 bump
  Require openjdk17 for Travis CI
  Upgrade to Spring Boot 3.0.8
  next dev version
  • Loading branch information
robertkrauss committed Aug 4, 2023
2 parents df442a0 + 45832d9 commit 10c3ce3
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
server-id: sonatype-nexus
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: java
jdk: openjdk17

script:
# the following command line builds the project, runs the tests with coverage
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To build and run this software, you require
* A current version of [Maven](https://maven.apache.org/)
* A current version of the [OpenJDK](https://developers.redhat.com/products/openjdk/download/)

This project is configured against Java 8. So for the time being you should go with that.
This project is configured against Java 17. So for the time being you should go with that.

### Installing

Expand Down
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Release notes
## 1.2.0
* Upgrade to Spring-Boot 3.0.8
* Upgrade to Java 17
## 1.1.0
* Updated to Spring-Boot 2.7.6
* Dependencies maintained
Expand Down
18 changes: 12 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@

<groupId>de.tk.opensource</groupId>
<artifactId>3rdparty-privacy-proxy</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<packaging>jar</packaging>
<name>3rd Party Privacy Proxy (Open Source)</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.6</version>
<version>3.0.8</version>
</parent>

<properties>
<java.version>1.8</java.version>
<java.version>17</java.version>
<maven.source.plugin>3.1.0</maven.source.plugin>
<maven.javadoc.plugin>3.1.1</maven.javadoc.plugin>
<maven.gpg.plugin>1.6</maven.gpg.plugin>
<maven.sonatype.nexus.plugin>1.6.13</maven.sonatype.nexus.plugin>
<commons.io.version>2.11.0</commons.io.version>
<snakeyaml.version>1.33</snakeyaml.version>
<snakeyaml.version>2.0</snakeyaml.version>
<hamcrest.all.version>1.3</hamcrest.all.version>
</properties>

Expand Down Expand Up @@ -130,15 +130,21 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.springframework.retry.RetryContext;
import org.springframework.retry.RetryListener;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.retry.listener.RetryListenerSupport;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.Collections;
Expand All @@ -35,7 +34,7 @@ public List<RetryListener> retryListeners() {
Logger log = LoggerFactory.getLogger(getClass());

return Collections.singletonList(
new RetryListenerSupport() {
new RetryListener() {
@Override
public <T, E extends Throwable> void onError(
RetryContext context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.web.util.WebUtils;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package de.tk.opensource.privacyproxy.util;

import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.impl.conn.DefaultProxyRoutePlanner;
import org.apache.http.protocol.HttpContext;
import org.apache.hc.client5.http.HttpRoute;
import org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.URISyntaxException;
import java.net.URL;

public class PrivacyProxyRoutePlanner extends DefaultProxyRoutePlanner {
Expand All @@ -23,13 +24,12 @@ public PrivacyProxyRoutePlanner(final ProxyHelper proxyHelper, final HttpHost ht
this.proxyHelper = proxyHelper;
}

@Override
public HttpRoute determineRoute(HttpHost host, HttpRequest request, HttpContext context)
throws HttpException {
try {
if (
Proxy.NO_PROXY.equals(
proxyHelper.selectProxy(new URL(request.getRequestLine().getUri()))
proxyHelper.selectProxy(new URL(request.getRequestUri()))
)
) {
LOGGER.debug("No Proxy for - {}", host);
Expand All @@ -38,11 +38,11 @@ public HttpRoute determineRoute(HttpHost host, HttpRequest request, HttpContext
} catch (MalformedURLException e) {
LOGGER.error(
"Could not build URL for proxy/no-proxy evaluation. Uri: '{}'",
request.getRequestLine().getUri(),
request.getRequestUri(),
e
);
}
LOGGER.debug("Using Proxy for {}", host);
return super.determineRoute(host, request, context);
return super.determineRoute(host, context);
}
}
19 changes: 10 additions & 9 deletions src/main/java/de/tk/opensource/privacyproxy/util/ProxyHelper.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package de.tk.opensource.privacyproxy.util;

import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.DefaultRoutePlanner;
import org.apache.http.impl.conn.SystemDefaultRoutePlanner;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.client5.http.impl.routing.DefaultRoutePlanner;
import org.apache.hc.client5.http.impl.routing.SystemDefaultRoutePlanner;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.util.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
Expand Down Expand Up @@ -129,9 +130,9 @@ public Proxy selectProxy(URL url) {

public CloseableHttpClient getCloseableHttpClient() {
final RequestConfig requestConfig =
RequestConfig.custom().setConnectTimeout(ROUTING_TIMEOUT_MILLISECONDS)
.setConnectionRequestTimeout(ROUTING_TIMEOUT_MILLISECONDS).setSocketTimeout(
ROUTING_TIMEOUT_MILLISECONDS
RequestConfig.custom().setConnectTimeout(Timeout.ofMilliseconds(ROUTING_TIMEOUT_MILLISECONDS))
.setConnectionRequestTimeout(Timeout.ofMilliseconds(ROUTING_TIMEOUT_MILLISECONDS)).setResponseTimeout(
Timeout.ofMilliseconds(ROUTING_TIMEOUT_MILLISECONDS)
)
.build();
return HttpClients.custom().setDefaultRequestConfig(requestConfig).setRoutePlanner(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.*;
import java.nio.charset.StandardCharsets;
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ spring:
server:
port: 2907
logging:
file: log/3rdparty-privacy-proxy.log
file:
name: log/3rdparty-privacy-proxy.log
level:
ROOT: INFO
de.tk.opensource.privacyproxy: INFO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.tk.opensource.privacyproxy.util;

import org.apache.http.impl.conn.SystemDefaultRoutePlanner;
import org.apache.hc.client5.http.impl.routing.SystemDefaultRoutePlanner;
import org.junit.jupiter.api.Test;

import java.net.InetSocketAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.jupiter.api.Test;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.*;
Expand Down

0 comments on commit 10c3ce3

Please sign in to comment.