我爲Cloudfront/S3前端存儲區創建了一個HTML接口,並且希望能夠通過該接口刪除其中的對象。我可以寫GET和POST請求來列出並查看桶中的對象,但我不知道如何編寫刪除請求。如何從HTML發送DELETE請求?
private String buildURL(String endpoint) {
String secret = 'some_secret';
Datetime dt = Datetime.now();
Long longTime = dt.getTime();
Long expiryLong = (longTime/1000) + 10;
String url = 'https://' + cf + endpoint +
'?Prefix=' + user_id;
String expiry = String.valueOf(expiryLong);
String policy = policy(url, expiry);
String policyEnc = EncodingUtil.base64Encode(Blob.valueOf(policy));
String rPolicy = cfReplace(policyEnc);
Blob mac = Crypto.generateMac('HMACSHA1',
Blob.valueOf(rPolicy),
Blob.valueOf(secret));
String signature = cfReplace(EncodingUtil.base64Encode(mac));
return 'https://' + cf + endpoint +
'?Prefix=' + user_id + '&Policy=' + policyEnc +
'&Signature=' + signature + '&Key-Pair-Id=' + keyPairId;
}
如果這是我用來生成一個URL查看對象的方法,我怎麼能它更改爲刪除請求,並附上一個<a href...
標籤?