回 楼主(allening) 的帖子
将你绑定的域名CNAME到CDN的加速域名
私有的也是支持的。代码如下:
这个是生成缩略图的java代码,你将endpoint、bucket等设置成你实际的值就可以了
public void testPutAndGet() {
final String OSS_ENDPOINT = "oss-cn-beijing.aliyuncs.com";
final String IMG_ENDPOINT = "img-cn-beijing.aliyuncs.com";
final String ACCESS_KEY_ID = "** Provide your access key id **";
final String ACCESS_KEY_SECRET = "** Provide your access key id **";;
String bucketName = "jy-bj-img";
String key = "example.jpg";
String filePath = "D:\\pic\\example.jpg";
String downloadPath = "D:\\pic\\
example@100w.jpg";
try {
OSSClient client4oss = new OSSClient(OSS_ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
client4oss.putObject(bucketName, key, new File(filePath));
System.out.println("upload " + key + " succeed");
OSSClient client4img = new OSSClient(IMG_ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName, key + "@100w");
client4img.getObject(getObjectRequest, new File(downloadPath));
System.out.println("down " + key + "@100 succeed");
} catch (OSSException oe) {
System.out.println(oe.getMessage());
} catch (Exception e) {
System.out.println(e.getMessage());
}
}