minor fixes when creating application post for new product
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@139840 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7d88d2ab01
commit
d7b7131227
|
@ -2,9 +2,6 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.server.utils;
|
||||||
|
|
||||||
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -60,6 +57,7 @@ import eu.trentorise.opendata.jackan.internal.org.apache.http.client.methods.Htt
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.entity.StringEntity;
|
import eu.trentorise.opendata.jackan.internal.org.apache.http.entity.StringEntity;
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.CloseableHttpClient;
|
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.HttpClientBuilder;
|
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.HttpClientBuilder;
|
||||||
|
import eu.trentorise.opendata.jackan.internal.org.apache.http.util.EntityUtils;
|
||||||
import eu.trentorise.opendata.jackan.model.CkanOrganization;
|
import eu.trentorise.opendata.jackan.model.CkanOrganization;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -467,21 +465,11 @@ public class Utils {
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
try {
|
try {
|
||||||
toReturn = new HashMap<String, Object>();
|
toReturn = new HashMap<String, Object>();
|
||||||
InputStream is = entity.getContent();
|
String jsonString = EntityUtils.toString(response.getEntity());
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
logger.debug("Response as string is " + jsonString);
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
String line = null;
|
|
||||||
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
sb.append(line + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.debug("Response as string is " + sb.toString());
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
toReturn = objectMapper.readValue(sb.toString(), HashMap.class);
|
toReturn = objectMapper.readValue(jsonString, HashMap.class);
|
||||||
logger.debug("Map is " + toReturn);
|
logger.debug("Map is " + toReturn);
|
||||||
|
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("Failed to read json object", e);
|
logger.error("Failed to read json object", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue