From 743d948d1c019a1e9921770614bc61fa570afa50 Mon Sep 17 00:00:00 2001 From: Alessia Bardi Date: Tue, 23 Jun 2020 11:52:19 +0200 Subject: [PATCH] print logs --- .../dhp/oa/graph/dump/gcat/GCatAPIClient.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/gcat/GCatAPIClient.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/gcat/GCatAPIClient.java index ab43c017fb..e77e23c34a 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/gcat/GCatAPIClient.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/gcat/GCatAPIClient.java @@ -2,6 +2,7 @@ package eu.dnetlib.dhp.oa.graph.dump.gcat; import java.io.IOException; +import java.net.URI; import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; import java.util.List; @@ -53,7 +54,9 @@ public class GCatAPIClient { public int publish(final String jsonMetadata) throws IOException, URISyntaxException { try (CloseableHttpClient client = HttpClients.createDefault()) { URIBuilder builder = new URIBuilder(getGcatBaseURL() + itemPath); - HttpPost post = new HttpPost(builder.build()); + URI uri = builder.build(); + System.out.println(uri.toString()); + HttpPost post = new HttpPost(uri); post.setHeader("gcube-token", getApplicationToken()); post.addHeader("Content-Type", "application/json"); post.addHeader("Accept", "application/json"); @@ -62,6 +65,7 @@ public class GCatAPIClient { HttpResponse response = client.execute(post); if (log.isDebugEnabled()) { log.debug(response.getStatusLine()); + System.out.println(response.getStatusLine()); log.debug(IOUtils.toString(response.getEntity().getContent())); } return response.getStatusLine().getStatusCode(); @@ -82,7 +86,9 @@ public class GCatAPIClient { URIBuilder builder = new URIBuilder(getGcatBaseURL() + itemPath) .addParameter("offset", String.valueOf(offset)) .addParameter("limit", String.valueOf(limit)); - HttpGet get = new HttpGet(builder.build()); + URI uri = builder.build(); + System.out.println(uri.toString()); + HttpGet get = new HttpGet(uri); get.setHeader("gcube-token", getApplicationToken()); get.addHeader("Content-Type", "application/json"); get.addHeader("Accept", "application/json"); @@ -112,7 +118,9 @@ public class GCatAPIClient { try (CloseableHttpClient client = HttpClients.createDefault()) { URIBuilder builder = new URIBuilder(getGcatBaseURL() + itemPath + "/" + resCatName) .addParameter("purge", "true"); - HttpDelete del = new HttpDelete(builder.build()); + URI uri = builder.build(); + System.out.println(uri.toString()); + HttpDelete del = new HttpDelete(uri); del.setHeader("gcube-token", getApplicationToken()); del.addHeader("Content-Type", "application/json"); del.addHeader("Accept", "application/json");