From dc98c39500a74fb55d5e951d80f1c38bcb286ec4 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Thu, 25 Feb 2021 12:29:18 +0100 Subject: [PATCH] more logging --- .../dhp/common/rest/DNetRestClient.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dhp-common/src/main/java/eu/dnetlib/dhp/common/rest/DNetRestClient.java b/dhp-common/src/main/java/eu/dnetlib/dhp/common/rest/DNetRestClient.java index 27713d9b5..853d22bc2 100644 --- a/dhp-common/src/main/java/eu/dnetlib/dhp/common/rest/DNetRestClient.java +++ b/dhp-common/src/main/java/eu/dnetlib/dhp/common/rest/DNetRestClient.java @@ -1,6 +1,9 @@ package eu.dnetlib.dhp.common.rest; +import java.util.Arrays; +import java.util.stream.Collectors; + import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -9,13 +12,10 @@ import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; - -import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Arrays; -import java.util.stream.Collectors; +import com.fasterxml.jackson.databind.ObjectMapper; public class DNetRestClient { @@ -53,11 +53,14 @@ public class DNetRestClient { CloseableHttpClient client = HttpClients.createDefault(); log.info("performing HTTP request, method {} on URI {}", r.getMethod(), r.getURI().toString()); - log.info("request headers: {}", - Arrays.asList(r.getAllHeaders()) - .stream() - .map(h -> h.getName() + ":" + h.getValue()) - .collect(Collectors.joining(","))); + log + .info( + "request headers: {}", + Arrays + .asList(r.getAllHeaders()) + .stream() + .map(h -> h.getName() + ":" + h.getValue()) + .collect(Collectors.joining(","))); CloseableHttpResponse response = client.execute(r); return IOUtils.toString(response.getEntity().getContent());