Search in sources :

Example 1 with COSDefaultAclHeaderHandler

use of com.qcloud.cos.internal.COSDefaultAclHeaderHandler in project cos-java-sdk-v5 by tencentyun.

the class COSClient method getAcl.

/**
 * <p>
 * Gets the AccessControlList for the specified resource. (bucket if only the bucketName
 * parameter is specified, otherwise the object with the specified key in the bucket).
 * </p>
 *
 * @param bucketName The name of the bucket whose ACL should be returned if the key parameter is
 *        not specified, otherwise the bucket containing the specified key.
 * @param key The object key whose ACL should be retrieve. If not specified, the bucket's ACL is
 *        returned.
 * @param versionId The version ID of the object version whose ACL is being retrieved.
 * @param originalRequest The original, user facing request object.
 *
 * @return The ACL for the specified resource.
 */
private AccessControlList getAcl(String bucketName, String key, String versionId, CosServiceRequest originalRequest) {
    if (originalRequest == null)
        originalRequest = new GenericBucketRequest(bucketName);
    CosHttpRequest<CosServiceRequest> request = createRequest(bucketName, key, originalRequest, HttpMethodName.GET);
    request.addParameter("acl", null);
    if (versionId != null) {
        request.addParameter("versionId", versionId);
    }
    @SuppressWarnings("unchecked") ResponseHeaderHandlerChain<AccessControlList> responseHandler = new ResponseHeaderHandlerChain<AccessControlList>(new Unmarshallers.AccessControlListUnmarshaller(), new COSDefaultAclHeaderHandler());
    return invoke(request, responseHandler);
}
Also used : Unmarshallers(com.qcloud.cos.internal.Unmarshallers) CosServiceRequest(com.qcloud.cos.internal.CosServiceRequest) COSDefaultAclHeaderHandler(com.qcloud.cos.internal.COSDefaultAclHeaderHandler) ResponseHeaderHandlerChain(com.qcloud.cos.internal.ResponseHeaderHandlerChain)

Aggregations

COSDefaultAclHeaderHandler (com.qcloud.cos.internal.COSDefaultAclHeaderHandler)1 CosServiceRequest (com.qcloud.cos.internal.CosServiceRequest)1 ResponseHeaderHandlerChain (com.qcloud.cos.internal.ResponseHeaderHandlerChain)1 Unmarshallers (com.qcloud.cos.internal.Unmarshallers)1