JCLOUDS-867: Azure support for Content-Disposition

Enabled by Azure API version 2013-08-15.
This commit is contained in:
Andrew Gaul 2015-03-27 17:37:30 -07:00
parent 8617c75b7e
commit 9cf97f3117
3 changed files with 9 additions and 9 deletions

View File

@ -55,7 +55,10 @@ public class BindAzureBlobMetadataToMultipartRequest implements Binder {
// bind BlockList-specific headers
ImmutableMap.Builder<String, String> headers = ImmutableMap.builder();
ContentMetadata contentMetadata = blob.getProperties().getContentMetadata();
// TODO: bind x-ms-blob-content-disposition after upgrading to API 2013-08-15
String contentDisposition = contentMetadata.getContentDisposition();
if (contentDisposition != null) {
headers.put("x-ms-blob-content-disposition", contentDisposition);
}
String contentEncoding = contentMetadata.getContentEncoding();
if (contentEncoding != null) {
headers.put("x-ms-blob-content-encoding", contentEncoding);

View File

@ -59,6 +59,11 @@ public class BindAzureBlobMetadataToRequest implements Binder {
headers.put("x-ms-blob-type", blob.getProperties().getType().toString());
String contentDisposition = blob.getPayload().getContentMetadata().getContentDisposition();
if (contentDisposition != null) {
headers.put("x-ms-blob-content-disposition", contentDisposition);
}
switch (blob.getProperties().getType()) {
case PAGE_BLOB:
headers.put(HttpHeaders.CONTENT_LENGTH, "0");

View File

@ -65,14 +65,6 @@ public class AzureBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
throw new SkipException("unsupported in Azure");
}
// according to docs, content disposition is not persisted
// http://msdn.microsoft.com/en-us/library/dd179440.aspx
@Override
protected void checkContentDisposition(Blob blob, String contentDisposition) {
assert blob.getPayload().getContentMetadata().getContentDisposition() == null;
assert blob.getMetadata().getContentMetadata().getContentDisposition() == null;
}
public void testMultipartChunkedFileStreamPowerOfTwoSize() throws IOException, InterruptedException {
final long limit = MultipartUploadStrategy.MAX_BLOCK_SIZE;
ByteSource input = TestUtils.randomByteSource().slice(0, limit);