带有B2的jclouds putBlob错误 - 不支持或不允许使用Cache-Control标头

时间:2018-05-06 18:38:43

标签: jclouds

我刚创建了一个b2存储桶并尝试使用jclouds上传文件。

PayloadBlobBuilder blobBuilder = blobStore.blobBuilder(remoteFileName)
        .payload(payload)
        .contentLength(payload.size());

Blob blob = blobBuilder.build();

String eTag = blobStore.putBlob(containerName, blob);

我得到的例外情况如下。

java.lang.IllegalArgumentException: Cache-Control header is not supported or allowed
    at org.jclouds.b2.handlers.ParseB2ErrorFromJsonContent.refineException(ParseB2ErrorFromJsonContent.java:45)
    at org.jclouds.b2.handlers.ParseB2ErrorFromJsonContent.handleError(ParseB2ErrorFromJsonContent.java:58)
    at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:138)
    at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:107)
    at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
    at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
    at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
    at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117)
    at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87)
    at com.sun.proxy.$Proxy402.uploadFile(Unknown Source)
    at org.jclouds.b2.blobstore.B2BlobStore.putBlob(B2BlobStore.java:242)
    at org.jclouds.b2.blobstore.B2BlobStore.putBlob(B2BlobStore.java:223)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:37)
    at com.sun.proxy.$Proxy387.putBlob(Unknown Source)

Caused by: org.jclouds.b2.B2ResponseException: request POST https://pod-000-1094-01.backblaze.com/b2api/v1/b2_upload_file/xxxx/c002_v0001094_t0008 HTTP/1.1 failed with code 400, error: B2Error{code=bad_request, message=Cache-Control header is not supported or allowed, status=400}
    ... 24 common frames omitted

我有什么遗失的。

1 个答案:

答案 0 :(得分:0)

B2服务会发出此错误,documents Cache-Control不支持:

  

b2_upload_file请求中不得包含以下HTTP标头:

     
      
  • 缓存控制
  •