fix bug: add headers as headers, not as body
@@ -33,8 +33,7 @@ import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
-public abstract class LinkedDataRestClient
-{
+public abstract class LinkedDataRestClient {
private final Logger logger = LoggerFactory.getLogger(getClass());
@@ -75,7 +74,6 @@ public abstract class LinkedDataRestClient
/**
* Retrieves RDF for the specified resource URI.
* Expects that the resource URI will lead to a 303 response, redirecting to the URI where RDF can be downloaded.
-
*
* @param resourceURI
* @return
@@ -84,6 +82,7 @@ public abstract class LinkedDataRestClient
requestHeaders) {
return readResourceDataWithHeaders(resourceURI, requesterWebID, requestHeaders).getDataset();
}
+
public abstract DatasetResponseWithStatusCodeAndHeaders readResourceDataWithHeaders(URI resourceURI, URI requesterWebID,
Map<String,
String>
@@ -100,7 +99,12 @@ public abstract class LinkedDataRestClient
int statusCode = -1;
Map<String, String> responseHeaderMap = null;
try {
- HttpEntity entity = new HttpEntity(requestHeaders);
+ HttpHeaders headers = new HttpHeaders();
+ for (String key : requestHeaders.keySet()) {
+ headers.add(key, requestHeaders.get(key));
+ }
+ HttpEntity entity = new HttpEntity(null, headers);
+
ResponseEntity<Dataset> response = restTemplate.exchange(resourceURI, HttpMethod.GET, entity, Dataset.class);
//RestTemplate will automatically follow redirects on HttpGet calls
statusCode = response.getStatusCode().value();
