more logging
This commit is contained in:
parent
271e88537b
commit
dc98c39500
|
@ -1,6 +1,9 @@
|
||||||
|
|
||||||
package eu.dnetlib.dhp.common.rest;
|
package eu.dnetlib.dhp.common.rest;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
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.entity.StringEntity;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class DNetRestClient {
|
public class DNetRestClient {
|
||||||
|
|
||||||
|
@ -53,11 +53,14 @@ public class DNetRestClient {
|
||||||
CloseableHttpClient client = HttpClients.createDefault();
|
CloseableHttpClient client = HttpClients.createDefault();
|
||||||
|
|
||||||
log.info("performing HTTP request, method {} on URI {}", r.getMethod(), r.getURI().toString());
|
log.info("performing HTTP request, method {} on URI {}", r.getMethod(), r.getURI().toString());
|
||||||
log.info("request headers: {}",
|
log
|
||||||
Arrays.asList(r.getAllHeaders())
|
.info(
|
||||||
.stream()
|
"request headers: {}",
|
||||||
.map(h -> h.getName() + ":" + h.getValue())
|
Arrays
|
||||||
.collect(Collectors.joining(",")));
|
.asList(r.getAllHeaders())
|
||||||
|
.stream()
|
||||||
|
.map(h -> h.getName() + ":" + h.getValue())
|
||||||
|
.collect(Collectors.joining(",")));
|
||||||
|
|
||||||
CloseableHttpResponse response = client.execute(r);
|
CloseableHttpResponse response = client.execute(r);
|
||||||
return IOUtils.toString(response.getEntity().getContent());
|
return IOUtils.toString(response.getEntity().getContent());
|
||||||
|
|
Loading…
Reference in New Issue