Fixed request headers

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-context-client@177011 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2019-02-06 11:03:35 +00:00
parent abbe64d57f
commit 61bdc05384
1 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import java.net.HttpURLConnection;
import java.util.List;
import java.util.UUID;
import org.gcube.common.gxhttp.reference.GXConnection;
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
import org.gcube.informationsystem.model.reference.entities.Context;
@ -46,6 +47,8 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
gxHTTPStringRequest.from(ResourceRegistryContextClient.class.getSimpleName());
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
gxHTTPStringRequest.header("Content-type", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
gxHTTPStringRequest.path(ContextPath.CONTEXTS_PATH_PART);
gxHTTPStringRequest.path(uuid.toString());
@ -117,6 +120,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
logger.trace("Going to read {} with UUID {}", Context.NAME, uuid);
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
gxHTTPStringRequest.from(ResourceRegistryContextClient.class.getSimpleName());
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
gxHTTPStringRequest.path(ContextPath.CONTEXTS_PATH_PART);
gxHTTPStringRequest.path(uuid);
@ -144,6 +148,8 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
gxHTTPStringRequest.from(ResourceRegistryContextClient.class.getSimpleName());
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
gxHTTPStringRequest.header("Content-type", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
gxHTTPStringRequest.path(ContextPath.CONTEXTS_PATH_PART);
gxHTTPStringRequest.path(uuid.toString());
@ -206,6 +212,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
logger.trace("Going to delete {} with UUID {}", Context.NAME, uuid);
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
gxHTTPStringRequest.from(ResourceRegistryContextClient.class.getSimpleName());
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
gxHTTPStringRequest.path(ContextPath.CONTEXTS_PATH_PART);
gxHTTPStringRequest.path(uuid);
@ -230,6 +237,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
logger.trace("Going to read {} with UUID {}", Context.NAME);
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
gxHTTPStringRequest.from(ResourceRegistryContextClient.class.getSimpleName());
gxHTTPStringRequest.header("Accept", GXConnection.APPLICATION_JSON_CHARSET_UTF_8);
gxHTTPStringRequest.path(ContextPath.CONTEXTS_PATH_PART);
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();