// 存储桶region可以在COS控制台指定存储桶的概览页查看 https://console.tencentcloud.com/cos5/bucket/ ,关于地域的详情见 https://www.tencentcloud.com/document/product/436/6224String region = "ap-beijing"; // 您的存储桶地域// 存储桶的默认加速域名String cdnDomain = "examplebucket-1250000000.file.myqcloud.com";CosXmlServiceConfig cosXmlServiceConfig = new CosXmlServiceConfig.Builder().isHttps(true).setRegion(region).setDebuggable(false).setHostFormat(cdnDomain) // 修改请求的域名.addHeader("Host", cdnDomain) // 修改 header 中的 host 字段.builder();// 不提供 credentialProvider 类,下载时可以通过给 url 添加 params 参数,来// 支持 CDN 权限校验CosXmlService cosXmlService = new CosXmlService(context, cosXmlServiceConfig);
// 存储桶region可以在COS控制台指定存储桶的概览页查看 https://console.tencentcloud.com/cos5/bucket/ ,关于地域的详情见 https://www.tencentcloud.com/document/product/436/6224String region = "ap-beijing"; // 您的存储桶地域String cdnCustomDomain = "exampledomain.com"; // 自定义加速域名CosXmlServiceConfig cosXmlServiceConfig = new CosXmlServiceConfig.Builder().isHttps(true).setRegion(region).setDebuggable(false).setHostFormat(cdnCustomDomain) // 修改请求的域名.addHeader("Host", cdnCustomDomain) // 修改 header 中的 host 字段.builder();// 不提供 credentialProvider 类,下载时可以通过给 url 添加 params 参数,来// 支持 CDN 权限校验CosXmlService cosXmlService = new CosXmlService(context, cosXmlServiceConfig);
// 存储桶region可以在COS控制台指定存储桶的概览页查看 https://console.tencentcloud.com/cos5/bucket/ ,关于地域的详情见 https://www.tencentcloud.com/document/product/436/6224String region = "ap-beijing"; // 您的存储桶地域String customDomain = "exampledomain.com"; // 自定义域名CosXmlServiceConfig cosXmlServiceConfig = new CosXmlServiceConfig.Builder().isHttps(true).setRegion(region).setDebuggable(false).setHostFormat(customDomain) // 修改请求的域名.builder();CosXmlService cosXmlService = new CosXmlService(context, cosXmlServiceConfig,credentialProvider);
// 存储桶region可以在COS控制台指定存储桶的概览页查看 https://console.tencentcloud.com/cos5/bucket/ ,关于地域的详情见 https://www.tencentcloud.com/document/product/436/6224String region = "ap-beijing"; // 您的存储桶地域CosXmlServiceConfig cosXmlServiceConfig = new CosXmlServiceConfig.Builder().isHttps(true).setRegion(region).setDebuggable(false).setAccelerate(true) // 使能全球加速域名.builder();CosXmlService cosXmlService = new CosXmlService(context, cosXmlServiceConfig,credentialProvider);
本页内容是否解决了您的问题?