From 2c3c3fad52e024ea1dcf5de7cd8cf3dd9f4ed94e Mon Sep 17 00:00:00 2001 From: adriancole Date: Sun, 3 Mar 2013 17:23:49 -0800 Subject: [PATCH] swift: explicitly set Expect header on methods that need it --- .../cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java | 2 ++ .../org/jclouds/openstack/swift/CommonSwiftAsyncClient.java | 3 +++ .../openstack/swift/blobstore/SwiftBlobSignerExpectTest.java | 2 ++ .../swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java | 5 ++++- .../blobstore/HPCloudObjectStorageBlobSignerExpectTest.java | 2 ++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java index 8572105a58..1fad64a517 100644 --- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java +++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobSignerExpectTest.java @@ -80,12 +80,14 @@ public class CloudFilesBlobSignerExpectTest extends BaseBlobSignerExpectTest { protected HttpRequest putBlob() { return HttpRequest.builder().method("PUT") .endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container/name") + .addHeader("Expect", "100-continue") .addHeader("X-Auth-Token", authToken).build(); } @Override protected HttpRequest putBlobWithTime() { return HttpRequest.builder().method("PUT") + .addHeader("Expect", "100-continue") .endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container/name?temp_url_sig=f83fa711f353f6f0bab3a66c56e35a972b9b3922&temp_url_expires=123456792").build(); } diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java index 0b642ea608..d867afb522 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.openstack.swift; +import static com.google.common.net.HttpHeaders.EXPECT; + import java.util.Map; import java.util.Set; @@ -196,6 +198,7 @@ public interface CommonSwiftAsyncClient { @Named("PutObject") @PUT @Path("/{container}/{name}") + @Headers(keys = EXPECT, values = "100-continue") @ResponseParser(ParseETagHeader.class) ListenableFuture putObject(@PathParam("container") String container, @PathParam("name") @ParamParser(ObjectName.class) @BinderParam(BindSwiftObjectMetadataToRequest.class) SwiftObject object); diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSignerExpectTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSignerExpectTest.java index 6a92ff5b35..d0c8bd2863 100644 --- a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSignerExpectTest.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftBlobSignerExpectTest.java @@ -78,6 +78,7 @@ public class SwiftBlobSignerExpectTest extends BaseBlobSignerExpectTest { protected HttpRequest putBlob() { return HttpRequest.builder().method("PUT") .endpoint("http://storage/container/name") + .addHeader("Expect", "100-continue") .addHeader("X-Auth-Token", "testtoken").build(); } @@ -85,6 +86,7 @@ public class SwiftBlobSignerExpectTest extends BaseBlobSignerExpectTest { protected HttpRequest putBlobWithTime() { return HttpRequest.builder().method("PUT") .endpoint("http://storage/container/name?temp_url_sig=e894c60fa1284cc575cf22d7786bab07b8c33610&temp_url_expires=123456792") + .addHeader("Expect", "100-continue") .build(); } diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java index 565e6f0d27..59ec1c5a4a 100644 --- a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/SwiftKeystoneBlobSignerExpectTest.java @@ -72,13 +72,16 @@ public class SwiftKeystoneBlobSignerExpectTest extends BaseBlobSignerExpectTest protected HttpRequest putBlob() { return HttpRequest.builder().method("PUT") .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name") + .addHeader("Expect", "100-continue") .addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").build(); } @Override protected HttpRequest putBlobWithTime() { return HttpRequest.builder().method("PUT") - .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name?temp_url_sig=72e5f6ebafab2b3da0586198797e58fb7478211e&temp_url_expires=123456792").build(); + .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name?temp_url_sig=72e5f6ebafab2b3da0586198797e58fb7478211e&temp_url_expires=123456792") + .addHeader("Expect", "100-continue") + .build(); } @Override diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java index 51bf2a44be..7dc156b82b 100644 --- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java @@ -75,6 +75,7 @@ public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpe protected HttpRequest putBlob() { return HttpRequest.builder().method("PUT") .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name") + .addHeader("Expect", "100-continue") .addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").build(); } @@ -82,6 +83,7 @@ public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpe protected HttpRequest putBlobWithTime() { return HttpRequest.builder().method("PUT") .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name?temp_url_sig=40806637803162%3Aidentity%3Ac90269245ab0a316d5ea5e654d4c2a975fb4bf77&temp_url_expires=123456792") + .addHeader("Expect", "100-continue") .build(); }