本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
從版本 1 到版本 2 剖析 Amazon S3 URI 的變更
本主題詳細說明將 Amazon S3 URI 從版本 1 (v1) 剖析到第 2 版 (v2) 的變更。
高階變更
要在 v1 中開始解析 S3 URI,您可以使用構造函數實例化。AmazonS3URI
在 v2 中,您呼叫parseUri()
的執行個體S3Utilities
,以傳回S3URI
.
變更 | v1 | v2 |
---|---|---|
Maven 的依賴 |
|
|
套件名稱 | com.amazonaws.services.s3 |
software.amazon.awssdk.services.s3 |
類別名稱 | AmazonS3URI |
S3URI |
API 變更
Behavior (行為) | v1 | v2 |
---|---|---|
剖析 S3 URI。 |
|
|
從 S3 URI 擷取儲存貯體名稱。 |
|
|
擷取金鑰。 |
|
|
擷取區域。 |
|
|
檢索 S3 URI 是否為路徑樣式。 |
|
|
擷取版本 ID。 |
|
|
擷取查詢參數。 | N/A |
|
行為改變
网址编码
v1 提供了傳遞標誌的選項,以指定 URI 是否應該進行 URL 編碼。預設值為 true
。
在 v2 中,不支持 URL 編碼。如果您使用具有保留或不安全字元的物件索引鍵或查詢參數,則必須對其進行 URL 編碼。例如,您需要" "
用%20
.