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

com.qcloud.cos.model.fetch.PutAsyncFetchTaskResultHandler Maven / Gradle / Ivy

Go to download

A single bundled dependency that includes all service and dependent JARs with third-party libraries relocated to different namespaces.

There is a newer version: 5.6.228
Show newest version
package com.qcloud.cos.model.fetch;

import com.qcloud.cos.http.CosHttpResponse;
import com.qcloud.cos.internal.AbstractCosResponseHandler;
import com.qcloud.cos.internal.CosServiceResponse;
import com.qcloud.cos.utils.Jackson;

public class PutAsyncFetchTaskResultHandler extends AbstractCosResponseHandler {
    
    @Override
    public CosServiceResponse handle(CosHttpResponse response) throws Exception {
        String requestId = response.getHeaders().get("x-cos-request-id");

        byte[] bytes = new byte[0];
        bytes = new byte[response.getContent().available()];
        response.getContent().read(bytes);

        PutAsyncFetchTaskResult result = Jackson.fromJsonString(new String(bytes), PutAsyncFetchTaskResult.class);
        result.setCosRequestId(requestId);

        CosServiceResponse cosResponse = new CosServiceResponse();
        cosResponse.setResult(result);
        return cosResponse;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy