Search in sources :

Example 1 with CIWorkflowServiceRequest

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

the class COSClient method invoke.

private <X, Y extends CosServiceRequest> X invoke(CosHttpRequest<Y> request, HttpResponseHandler<CosServiceResponse<X>> responseHandler) throws CosClientException, CosServiceException {
    COSSigner cosSigner = clientConfig.getCosSigner();
    COSCredentials cosCredentials;
    CosServiceRequest cosServiceRequest = request.getOriginalRequest();
    if (cosServiceRequest != null && cosServiceRequest.getCosCredentials() != null) {
        cosCredentials = cosServiceRequest.getCosCredentials();
    } else {
        cosCredentials = fetchCredential();
    }
    Date expiredTime = new Date(System.currentTimeMillis() + clientConfig.getSignExpired() * 1000);
    boolean isCIWorkflowRequest = cosServiceRequest instanceof CIWorkflowServiceRequest;
    cosSigner.setCIWorkflowRequest(isCIWorkflowRequest);
    cosSigner.sign(request, cosCredentials, expiredTime);
    return this.cosHttpClient.exeute(request, responseHandler);
}
Also used : COSCredentials(com.qcloud.cos.auth.COSCredentials) COSSigner(com.qcloud.cos.auth.COSSigner) CosServiceRequest(com.qcloud.cos.internal.CosServiceRequest) CIWorkflowServiceRequest(com.qcloud.cos.internal.CIWorkflowServiceRequest) Date(java.util.Date)

Aggregations

COSCredentials (com.qcloud.cos.auth.COSCredentials)1 COSSigner (com.qcloud.cos.auth.COSSigner)1 CIWorkflowServiceRequest (com.qcloud.cos.internal.CIWorkflowServiceRequest)1 CosServiceRequest (com.qcloud.cos.internal.CosServiceRequest)1 Date (java.util.Date)1