void com.qcloud.cos.ClientConfig.setEndPointSuffix(String endPointSuffix)
// 1. Use a CDN acceleration domain. COS verification information does not need to be sent.COSCredentials cred = new AnonymousCOSCredentials();// 2. Set the region abbreviation for the bucket. For abbreviations of COS regions, visit https://www.tencentcloud.com/document/product/436/6224ClientConfig clientConfig = new ClientConfig(new Region("ap-beijing"));// HTTPS is recommended.clientConfig.setHttpProtocol(HttpProtocol.https);// 3. Set the suffix for the default CDN acceleration domain.String cdnSuffix = "file.myqcloud.com";clientConfig.setEndPointSuffix(cdnSuffix);// 4. Generate a COS clientCOSClient cosclient = new COSClient(cred, clientConfig);
Parameter | Description | Type |
endPointSuffix | Set the domain suffix to use the CDN acceleration domain name | String |
void com.qcloud.cos.ClientConfig.setEndpointBuilder(EndpointBuilder endpointBuilder)
// 1. Use a CDN acceleration domain. COS verification information does not need to be sent.COSCredentials cred = new AnonymousCOSCredentials();// 2. Set the region abbreviation for the bucket. For abbreviations of COS regions, visit https://www.tencentcloud.com/document/product/436/6224ClientConfig clientConfig = new ClientConfig(new Region("ap-beijing"));// HTTPS is recommended, which requires the custom domain to have the relevant HTTPS certificate.clientConfig.setHttpProtocol(HttpProtocol.https);// 3. Set the custom CDN domain name.// The `get service` request will use this domain, which is fixed.String serviceApiEndpoint = "service.cos.myqcloud.com";String cdnEndpoint = "xxx.xxx.com";UserSpecifiedEndpointBuilder endPointBuilder = new UserSpecifiedEndpointBuilder(cdnEndpoint, serviceApiEndpoint);clientConfig.setEndpointBuilder(endPointBuilder);// 4. Generate a COS clientCOSClient cosclient = new COSClient(cred, clientConfig);
Parameter | Description | Type |
endPointerBuilder | Constructs the custom CDN acceleration domain. | UserSpecifiedEndpointBuilder |
Parameter | Description | Type |
generalApiEndpoint | Custom CDN acceleration domain name | String |
getServiceApiEndpoint | Fixed to service.cos.myqcloud.com | String |
void com.qcloud.cos.ClientConfig.setEndpointBuilder(EndpointBuilder endpointBuilder)
// 1. Initialize user authentication information (secretId, secretKey).// You can log in to the CAM console to view and manage `secretId` and `secretKey`.String secretId = "SECRETID";String secretKey = "SECRETKEY";COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);// 2. Set the region abbreviation for the bucket. For abbreviations of COS regions, visit https://www.tencentcloud.com/document/product/436/6224ClientConfig clientConfig = new ClientConfig(new Region("ap-beijing"));// HTTPS is recommended.clientConfig.setHttpProtocol(HttpProtocol.https);// 3. Set the custom domain name.// The get service request will use this domain, which is fixed.String serviceApiEndpoint = "service.cos.myqcloud.com";String userEndpoint = "xxx.xxx.com";UserSpecifiedEndpointBuilder endPointBuilder = new UserSpecifiedEndpointBuilder(userEndpoint, serviceApiEndpoint);clientConfig.setEndpointBuilder(endPointBuilder);// 4. Generate a COS clientCOSClient cosclient = new COSClient(cred, clientConfig);
Parameter | Description | Type |
endPointerBuilder | Constructs the custom origin server domain. | UserSpecifiedEndpointBuilder |
Parameter | Description | Type |
generalApiEndpoint | Custom origin server domain | String |
getServiceApiEndpoint | Fixed to service.cos.myqcloud.com | String |
void com.qcloud.cos.ClientConfig.setEndPointSuffix(String endPointSuffix)
// 1. Initialize user authentication information (`secretId`, `secretKey`).// You can log in to the CAM console to view and manage `secretId` and `secretKey`.String secretId = "SECRETID";String secretKey = "SECRETKEY";COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);// 2. Set the region abbreviation for the bucket. For abbreviations of COS regions, visit https://www.tencentcloud.com/document/product/436/6224ClientConfig clientConfig = new ClientConfig(new Region("ap-beijing"));// HTTPS is recommended.clientConfig.setHttpProtocol(HttpProtocol.https);// 3. Set the suffix for the global acceleration endpoint.String cosSuffix = "cos.accelerate.myqcloud.com";clientConfig.setEndPointSuffix(cosSuffix);// 4. Generate a COS clientCOSClient cosclient = new COSClient(cred, clientConfig);
Parameter | Description | Type |
endPointSuffix | Set the domain suffix to use a global acceleration domain name. | String |
Was this page helpful?