Changes in parsing Amazon S3 URIs from version 1 to version 2
This topic details the changes in parsing Amazon S3 URIs from version 1 (v1) to version 2 (v2.).
High-level changes
To begin parsing an S3 URI in v1, you instantiate an AmazonS3URI
by using a
constructor. In v2 you call parseUri()
on an instance of
S3Utilities
, to return an S3URI
.
Change | v1 | v2 |
---|---|---|
Maven dependencies |
|
|
Package name | com.amazonaws.services.s3 |
software.amazon.awssdk.services.s3 |
Class names | AmazonS3URI |
S3URI |
1
Latest
version
API changes
Behavior | v1 | v2 |
---|---|---|
Parse an S3 URI. |
|
|
Retrieve the bucket name from an S3 URI. |
|
|
Retrieve the key. |
|
|
Retrieve the region. |
|
|
Retrieve whether the S3 URI is path style. |
|
|
Retrieve the version ID. |
|
|
Retrieve the query parameters. | N/A |
|
Behavior changes
URL encoding
v1 provides the option to pass in a flag to specify whether the URI should be URL
encoded. The default value is true
.
In v2, URL encoding is not supported. If you work with object keys or query
parameters that have reserved or unsafe characters, you must URL encode them. For
example you need to replace a whitespace " "
with
%20
.