All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qcloud.cos.model.PutSymlinkResultHandler Maven / Gradle / Ivy

The newest version!
package com.qcloud.cos.model;

import com.qcloud.cos.Headers;
import com.qcloud.cos.http.CosHttpResponse;
import com.qcloud.cos.internal.AbstractCosResponseHandler;
import com.qcloud.cos.internal.CosServiceResponse;

import java.util.Map;

public class PutSymlinkResultHandler extends AbstractCosResponseHandler {
    @Override
    public CosServiceResponse handle(CosHttpResponse response) throws Exception {
        PutSymlinkResult putSymlinkResult = new PutSymlinkResult();
        final CosServiceResponse cosServiceResponse = new CosServiceResponse<>();
        for (Map.Entry header : response.getHeaders().entrySet()) {
            String key = header.getKey();
            String value = header.getValue();

            if (Headers.REQUEST_ID.compareToIgnoreCase(key) == 0) {
                putSymlinkResult.setRequestId(value);
                continue;
            }

            if (Headers.ETAG.compareToIgnoreCase(key) == 0) {
                putSymlinkResult.setETag(value);
                continue;
            }

            if (Headers.STORAGE_CLASS.compareToIgnoreCase(key) == 0) {
                putSymlinkResult.setStorageClass(value);
            }
        }

        cosServiceResponse.setResult(putSymlinkResult);
        return cosServiceResponse;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy