|
31 | 31 |
|
32 | 32 | import org.apache.commons.codec.binary.Hex;
|
33 | 33 | import org.apache.http.HttpEntity;
|
| 34 | +import org.apache.http.HttpHeaders; |
34 | 35 | import org.apache.http.client.ClientProtocolException;
|
35 | 36 | import org.apache.http.client.config.CookieSpecs;
|
36 | 37 | import org.apache.http.client.config.RequestConfig;
|
37 | 38 | import org.apache.http.client.methods.CloseableHttpResponse;
|
38 | 39 | import org.apache.http.client.methods.HttpGet;
|
39 | 40 | import org.apache.http.client.methods.HttpPost;
|
40 | 41 | import org.apache.http.client.methods.HttpPut;
|
| 42 | +import org.apache.http.client.methods.HttpUriRequest; |
| 43 | +import org.apache.http.client.methods.RequestBuilder; |
41 | 44 | import org.apache.http.client.protocol.HttpClientContext;
|
42 | 45 | import org.apache.http.conn.ssl.NoopHostnameVerifier;
|
43 | 46 | import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
@@ -410,10 +413,18 @@ protected String uploadDatafile(Resource file, String path) {
|
410 | 413 | String storageIdentifier = data.getString("storageIdentifier");
|
411 | 414 |
|
412 | 415 | HttpPut httpput = new HttpPut(uploadUrl);
|
| 416 | + |
| 417 | + |
| 418 | + httpput.addHeader("x-amz-tagging", "dv-state=temp"); |
413 | 419 | MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
414 | 420 |
|
415 | 421 | try (InputStream inStream = file.getInputStream(); DigestInputStream digestInputStream = new DigestInputStream(inStream, messageDigest)) {
|
416 |
| - |
| 422 | + // This is hte new form for requests - keeping the example but won't update until we can change all |
| 423 | + //HttpUriRequest httpput = RequestBuilder.put() |
| 424 | + // .setUri(uploadUrl) |
| 425 | + // .setHeader("x-amz-tagging", "dv-state=temp") |
| 426 | + // .setEntity(new InputStreamEntity(digestInputStream, file.length())) |
| 427 | + // .build(); |
417 | 428 | httpput.setEntity(new InputStreamEntity(digestInputStream, file.length()));
|
418 | 429 | CloseableHttpResponse putResponse = httpclient.execute(httpput);
|
419 | 430 | try {
|
@@ -508,6 +519,9 @@ protected String uploadDatafile(Resource file, String path) {
|
508 | 519 | } finally {
|
509 | 520 | EntityUtils.consumeQuietly(response.getEntity());
|
510 | 521 | }
|
| 522 | + } else { |
| 523 | + println("Upload failed with status: " + putStatus + " (skipping)"); |
| 524 | + retry=0; |
511 | 525 | }
|
512 | 526 |
|
513 | 527 | } catch (IOException e) {
|
|
0 commit comments