Fix accept header for content download 32/2832/1
authorSerban Jora <sj2381@att.com>
Thu, 13 Sep 2018 19:29:15 +0000 (15:29 -0400)
committerSerban Jora <sj2381@att.com>
Thu, 13 Sep 2018 19:29:45 +0000 (15:29 -0400)
Change-Id: Ic1882c72d7940f55a324bf7f8709cda0b192fc5d
Issue-ID: ACUMOS-1690
Signed-off-by: Serban Jora <sj2381@att.com>
gateway/src/main/java/org/acumos/federation/gateway/common/FederationClient.java

index ad3ff11..2e04542 100644 (file)
@@ -38,7 +38,9 @@ import org.springframework.core.ParameterizedTypeReference;
 import org.springframework.core.io.Resource;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
+import org.springframework.http.RequestEntity;
 import org.springframework.http.ResponseEntity;
+import org.springframework.http.MediaType;
 import org.springframework.util.Base64Utils;
 import org.springframework.web.client.HttpStatusCodeException;
 import org.springframework.web.client.HttpClientErrorException;
@@ -358,8 +360,12 @@ public class FederationClient extends AbstractClient {
        protected Resource download(URI theUri) throws HttpStatusCodeException {
                log.info(EELFLoggerDelegate.debugLogger, "Query for {}", theUri);
                ResponseEntity<Resource> response = null;
+               RequestEntity<Void> request = RequestEntity
+                                                                                                                                       .get(theUri)
+                                                                                                                                       .accept(MediaType.APPLICATION_OCTET_STREAM)
+                                                                                                                                       .build();
                try {
-                       response = restTemplate.exchange(theUri, HttpMethod.GET, null, Resource.class);
+                       response = restTemplate.exchange(request, Resource.class);
                }
                catch (HttpStatusCodeException x) {
                        log.error(EELFLoggerDelegate.errorLogger, theUri + " failed", x);