cos:OptionsObject. For more authorization information, see CAM-supported business APIs.Feature Name | Description | Example code |
Checking CORS Configuration | Provides the capability to configure preflight CORS for objects. |
// A bucket name consists of bucketname-appid. You must include the appid. You can view bucket names in the COS console. https://console.tencentcloud.com/cos5/bucketString bucket = "examplebucket-1250000000";String cosPath = "exampleobject"; // The location identifier of the object in the bucket, i.e., the object key.String origin = "https://cloud.tencent.com";String accessMethod = "PUT";OptionObjectRequest optionObjectRequest = new OptionObjectRequest(bucket,cosPath, origin,accessMethod);cosXmlService.optionObjectAsync(optionObjectRequest,new CosXmlResultListener() {@Overridepublic void onSuccess(CosXmlRequest cosXmlRequest, CosXmlResult result) {OptionObjectResult optionObjectResult = (OptionObjectResult) result;}// If you call the API using kotlin, note that the exception in the callback method must be nullable. Otherwise, the onFail method will not be called, as follows:// The type of clientException is CosXmlClientException?, and the type of serviceException is CosXmlServiceException?@Overridepublic void onFail(CosXmlRequest cosXmlRequest,@Nullable CosXmlClientException clientException,@Nullable CosXmlServiceException serviceException) {if (clientException != null) {clientException.printStackTrace();} else {serviceException.printStackTrace();}}});
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários