@@ -1355,15 +1355,17 @@ public void getObject(String bucketName, String objectName, String fileName)
13551355
13561356
13571357 /**
1358- * Returns an presigned URL to download the object in the bucket with given expiry time.
1358+ * Returns an presigned URL to download the object in the bucket with given expiry time with custom request params .
13591359 *
13601360 * </p><b>Example:</b><br>
1361- * <pre>{@code String url = minioClient.presignedGetObject("my-bucketname", "my-objectname", 60 * 60 * 24);
1361+ * <pre>{@code String url = minioClient.presignedGetObject("my-bucketname", "my-objectname", 60 * 60 * 24, reqParams );
13621362 * System.out.println(url); }</pre>
13631363 *
13641364 * @param bucketName Bucket name.
13651365 * @param objectName Object name in the bucket.
13661366 * @param expires Expiration time in seconds of presigned URL.
1367+ * @param reqParams Override values for set of response headers. Currently supported request parameters are
1368+ * [response-expires, response-content-type, response-cache-control, response-content-disposition]
13671369 *
13681370 * @return string contains URL to download the object.
13691371 *
@@ -1373,7 +1375,8 @@ public void getObject(String bucketName, String objectName, String fileName)
13731375 * @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation
13741376 * @throws InvalidExpiresRangeException upon input expires is out of range
13751377 */
1376- public String presignedGetObject (String bucketName , String objectName , Integer expires )
1378+ public String presignedGetObject (String bucketName , String objectName , Integer expires ,
1379+ Map <String , String > reqParams )
13771380 throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException ,
13781381 InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException ,
13791382 InternalException , InvalidExpiresRangeException {
@@ -1386,11 +1389,37 @@ public String presignedGetObject(String bucketName, String objectName, Integer e
13861389 String region = BucketRegionCache .INSTANCE .region (bucketName );
13871390
13881391 Request request = createRequest (Method .GET , bucketName , objectName , region ,
1389- null , null , null , null , 0 );
1392+ null , reqParams , null , null , 0 );
13901393 HttpUrl url = Signer .presignV4 (request , region , accessKey , secretKey , expires );
13911394 return url .toString ();
13921395 }
13931396
1397+ /**
1398+ * Returns an presigned URL to download the object in the bucket with given expiry time.
1399+ *
1400+ * </p><b>Example:</b><br>
1401+ * <pre>{@code String url = minioClient.presignedGetObject("my-bucketname", "my-objectname", 60 * 60 * 24);
1402+ * System.out.println(url); }</pre>
1403+ *
1404+ * @param bucketName Bucket name.
1405+ * @param objectName Object name in the bucket.
1406+ * @param expires Expiration time in seconds of presigned URL.
1407+ *
1408+ * @return string contains URL to download the object.
1409+ *
1410+ * @throws InvalidBucketNameException upon an invalid bucket name
1411+ * @throws InvalidKeyException upon an invalid access key or secret key
1412+ * @throws IOException upon signature calculation failure
1413+ * @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation
1414+ * @throws InvalidExpiresRangeException upon input expires is out of range
1415+ */
1416+ public String presignedGetObject (String bucketName , String objectName , Integer expires )
1417+ throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException ,
1418+ InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException ,
1419+ InternalException , InvalidExpiresRangeException {
1420+ return presignedGetObject (bucketName , objectName , expires , null );
1421+ }
1422+
13941423
13951424 /**
13961425 * Returns an presigned URL to download the object in the bucket with default expiry time.
@@ -1413,7 +1442,7 @@ public String presignedGetObject(String bucketName, String objectName)
14131442 throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException ,
14141443 InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException ,
14151444 InternalException , InvalidExpiresRangeException {
1416- return presignedGetObject (bucketName , objectName , DEFAULT_EXPIRY_TIME );
1445+ return presignedGetObject (bucketName , objectName , DEFAULT_EXPIRY_TIME , null );
14171446 }
14181447
14191448
0 commit comments