Azure supports setting cache control headers on blobs through the
"x-ms-blob-cache-control" header on a blob put; but there does not seem to
be an easy way to set this through azure.

Adding:
   var meta = new util.HashMap[String, String]
   meta.put("x-ms-blob-cache-control", "must-revalidate")
   var payload =
context.getAsyncBlobStore.blobBuilder(test_key).userMetadata(meta)...

Results in the header being prefixed with "x-ms-meta-" because the
AzureBlobApiMetadata class sets this as the PROPERTY_USER_METADATA_PREFIX
property; which is bound to the request deep down in the bowels of jclouds.

For user meta-data this is the correct behavior; as described in
   http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx

But there does not seem to be an easy way to work around the prefix binding
for things which sort-of fall into this grey area of content/user data. A
work-around I'm using is to set the override properties, as in:

    val prop = BaseRestApiMetadata.defaultProperties()
    prop.put(BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX, "")
    val context =
ContextBuilder.newBuilder("azureblob").overrides(prop).credentials("jkew","a
secret key")
      .modules(modules).buildView(classOf[BlobStoreContext])

That's OK for some things; but we need to do some sweet cross-cloud
blobbery, and it would be great if there were some general way of setting
the desired Cache-Control headers for CDNs, or a convenient way of
by-passing the prefix bindings somehow for some properties.

Should I file a feature request; or is this just not a general enough
feature to be exposed at a more general level?

-John Kew

Reply via email to