summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java9
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java6
2 files changed, 7 insertions, 8 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
index 8426282b..7827ac72 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
@@ -3,13 +3,13 @@ package org.openslx.dozmod.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.io.InputStreamReader;
-import java.net.URL;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.hc.client5.http.classic.methods.HttpGet;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openslx.dozmod.App;
@@ -117,9 +117,10 @@ public class ClientVersion {
public void run() {
App.waitForInit();
String json = null;
- try (InputStream reader = new URL(urlString).openStream()) {
+ HttpGet get = new HttpGet(urlString);
+ try (CloseableHttpResponse resp = ProxyConfigurator.getClient().execute(get)) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- buffer.write(reader);
+ buffer.write(resp.getEntity().getContent());
buffer.close();
json = new String(buffer.toByteArray(), StandardCharsets.UTF_8);
} catch (Exception e) {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java
index 711915aa..29aa86bd 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java
@@ -5,7 +5,6 @@ import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@@ -17,10 +16,10 @@ import org.apache.hc.client5.http.config.ConnectionConfig;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.config.TlsConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
-import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.ssl.TLS;
import org.apache.hc.core5.util.Timeout;
import org.apache.logging.log4j.Level;
@@ -256,8 +255,7 @@ public class ProxyConfigurator {
httpGet.setHeader("Accept", "text/html, application/vnd.paos+xml");
httpGet.setHeader("PAOS",
"ver=\"urn:liberty:paos:2003-08\";\"urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp\"");
- try {
- HttpResponse response = client.execute(httpGet);
+ try (CloseableHttpResponse response = client.execute(httpGet)) {
LOGGER.debug("Master server replies with " + response.getCode());
int rc = response.getCode();
return rc >= 200 && rc < 300;