Viewing CORS Rules

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference

You can call ObsClient.getBucketCors to view CORS rules of a bucket. Sample code is as follows:

String endPoint = "https://your-endpoint";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
// Create an instance of ObsClient.
ObsClient obsClient = new ObsClient(ak, sk, endPoint);


BucketCors cors = obsClient.getBucketCors("bucketname");
for(BucketCorsRule rule : cors.getRules()){
    Log.i("GetBucketCors","\t" + rule.getId());
    Log.i("GetBucketCors","\t" + rule.getMaxAgeSecond());
    Log.i("GetBucketCors","\t" + rule.getAllowedHeader());
    Log.i("GetBucketCors","\t" + rule.getAllowedOrigin());
    Log.i("GetBucketCors","\t" + rule.getAllowedMethod());
    Log.i("GetBucketCors","\t" + rule.getExposeHeader());
}