@Override public URL getUrl(String bucketName, String key) { Request<?> request = new DefaultRequest<Object>(Constants.S3_SERVICE_DISPLAY_NAME); resolveRequestEndpoint(request, bucketName, key, endpoint); return ServiceUtils.convertRequestToUrl(request, false, false); }
protected <X extends AmazonWebServiceRequest> Request<X> createRequest(String bucketName, String key, X originalRequest, HttpMethodName httpMethod, URI endpoint) { // If the underlying AmazonS3Client has enabled accelerate mode and the original // request operation is accelerate mode supported, then the request will use the // s3-accelerate endpoint to performe the operations. if (clientOptions.isAccelerateModeEnabled() && !(originalRequest instanceof S3AccelerateUnsupported)) { if (clientOptions.isDualstackEnabled()) { endpoint = RuntimeHttpUtils.toUri(Constants.S3_ACCELERATE_DUALSTACK_HOSTNAME, clientConfiguration); } else { endpoint = RuntimeHttpUtils.toUri(Constants.S3_ACCELERATE_HOSTNAME, clientConfiguration); } } Request<X> request = new DefaultRequest<X>(originalRequest, Constants.S3_SERVICE_DISPLAY_NAME); request.setHttpMethod(httpMethod); request.addHandlerContext(S3HandlerContextKeys.IS_CHUNKED_ENCODING_DISABLED, Boolean.valueOf(clientOptions.isChunkedEncodingDisabled())); request.addHandlerContext(S3HandlerContextKeys.IS_PAYLOAD_SIGNING_ENABLED, Boolean.valueOf(clientOptions.isPayloadSigningEnabled())); resolveRequestEndpoint(request, bucketName, key, endpoint); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, SERVICE_ID); return request; }
/** * Set the request's endpoint and resource path with the new region provided * * From versions 2.4.+ until 2.10.+, AmazonS3Client adds an additional layer of URL Encoding for * the key names. This resulted in the key name being double encoded because the Core Runtime * (UrlHttpClient) encodes the Http Url which contains the key name. Starting 2.11.0, AmazonS3Client * does not do the extra encoding for the key name and just uses te key name that is passed in. * * @param request Request to set endpoint for * @param bucketName the name of the bucket * @param key key that identifies the object */ public void resolveRequestEndpoint(Request<?> request, String bucketName, String key) { resolveRequestEndpoint(request, bucketName, key, null); }
resolveRequestEndpoint(request, bucketName, key, RuntimeHttpUtils.toUri(RegionUtils.getRegion(region).getServiceEndpoint(S3_SERVICE_NAME), clientConfiguration)); return updateSigV4SignerWithRegion((AWSS3V4Signer) signer, region); } else if (request.getOriginalRequest() instanceof GeneratePresignedUrlRequest) {
/** * Returns an URL for the object stored in the specified bucket and key. * <p> * If the object identified by the given bucket and key has public read * permissions (ex: {@link CannedAccessControlList#PublicRead}), then this * URL can be directly accessed to retrieve the object's data. * * @param bucketName The name of the bucket containing the object whose URL * is being requested. * @param key The key under which the object whose URL is being requested is * stored. * @return A unique URL for the object stored in the specified bucket and * key. */ @Override public URL getUrl(String bucketName, String key) { final Request<?> request = new DefaultRequest<Object>(Constants.S3_SERVICE_DISPLAY_NAME); resolveRequestEndpoint(request, bucketName, key); return ServiceUtils.convertRequestToUrl(request); }
protected <X extends AmazonWebServiceRequest> Request<X> createRequest(String bucketName, String key, X originalRequest, HttpMethodName httpMethod, URI endpoint) { final Request<X> request = new DefaultRequest<X>(originalRequest, Constants.S3_SERVICE_DISPLAY_NAME); // If the underlying AmazonS3Client has enabled accelerate mode and the // original request operation is accelerate mode supported, then the request // will use the s3-accelerate endpoint to performs the operations. if (clientOptions.isAccelerateModeEnabled() && !(request.getOriginalRequest() instanceof S3AccelerateUnsupported)) { if (clientOptions.isDualstackEnabled()) { endpoint = RuntimeHttpUtils.toUri(Constants.S3_ACCELERATE_DUALSTACK_HOSTNAME, clientConfiguration); } else { endpoint = RuntimeHttpUtils.toUri(Constants.S3_ACCELERATE_HOSTNAME, clientConfiguration); } } request.setHttpMethod(httpMethod); resolveRequestEndpoint(request, bucketName, key, endpoint); return request; }
/** * Set the request's endpoint and resource path with the new region provided * * From versions 2.4.+ until 2.10.+, AmazonS3Client adds an additional layer of URL Encoding for * the key names. This resulted in the key name being double encoded because the Core Runtime * (UrlHttpClient) encodes the Http Url which contains the key name. Starting 2.11.0, AmazonS3Client * does not do the extra encoding for the key name and just uses te key name that is passed in. * * @param request Request to set endpoint for * @param bucketName the name of the bucket * @param key key that identifies the object */ public void resolveRequestEndpoint(Request<?> request, String bucketName, String key) { resolveRequestEndpoint(request, bucketName, key, null); }
resolveRequestEndpoint(request, bucketName, key, RuntimeHttpUtils.toUri( RegionUtils.getRegion(region).getServiceEndpoint(S3_SERVICE_NAME), clientConfiguration));
@Override public URL getUrl(String bucketName, String key) { Request<?> request = new DefaultRequest<Object>(Constants.S3_SERVICE_DISPLAY_NAME); resolveRequestEndpoint(request, bucketName, key, endpoint); return ServiceUtils.convertRequestToUrl(request, false, false); }
/** * Returns an URL for the object stored in the specified bucket and key. * <p> * If the object identified by the given bucket and key has public read * permissions (ex: {@link CannedAccessControlList#PublicRead}), then this * URL can be directly accessed to retrieve the object's data. * * @param bucketName The name of the bucket containing the object whose URL * is being requested. * @param key The key under which the object whose URL is being requested is * stored. * @return A unique URL for the object stored in the specified bucket and * key. */ @Override public URL getUrl(String bucketName, String key) { final Request<?> request = new DefaultRequest<Object>(Constants.S3_SERVICE_DISPLAY_NAME); resolveRequestEndpoint(request, bucketName, key); return ServiceUtils.convertRequestToUrl(request); }
protected <X extends AmazonWebServiceRequest> Request<X> createRequest(String bucketName, String key, X originalRequest, HttpMethodName httpMethod, URI endpoint) { // If the underlying AmazonS3Client has enabled accelerate mode and the original // request operation is accelerate mode supported, then the request will use the // s3-accelerate endpoint to performe the operations. if (clientOptions.isAccelerateModeEnabled() && !(originalRequest instanceof S3AccelerateUnsupported)) { if (clientOptions.isDualstackEnabled()) { endpoint = RuntimeHttpUtils.toUri(Constants.S3_ACCELERATE_DUALSTACK_HOSTNAME, clientConfiguration); } else { endpoint = RuntimeHttpUtils.toUri(Constants.S3_ACCELERATE_HOSTNAME, clientConfiguration); } } Request<X> request = new DefaultRequest<X>(originalRequest, Constants.S3_SERVICE_DISPLAY_NAME); request.setHttpMethod(httpMethod); request.addHandlerContext(S3HandlerContextKeys.IS_CHUNKED_ENCODING_DISABLED, Boolean.valueOf(clientOptions.isChunkedEncodingDisabled())); request.addHandlerContext(S3HandlerContextKeys.IS_PAYLOAD_SIGNING_ENABLED, Boolean.valueOf(clientOptions.isPayloadSigningEnabled())); resolveRequestEndpoint(request, bucketName, key, endpoint); return request; }
protected <X extends AmazonWebServiceRequest> Request<X> createRequest(String bucketName, String key, X originalRequest, HttpMethodName httpMethod, URI endpoint) { final Request<X> request = new DefaultRequest<X>(originalRequest, Constants.S3_SERVICE_DISPLAY_NAME); // If the underlying AmazonS3Client has enabled accelerate mode and the // original request operation is accelerate mode supported, then the request // will use the s3-accelerate endpoint to performs the operations. if (clientOptions.isAccelerateModeEnabled() && !(request.getOriginalRequest() instanceof S3AccelerateUnsupported)) { if (clientOptions.isDualstackEnabled()) { endpoint = RuntimeHttpUtils.toUri(Constants.S3_ACCELERATE_DUALSTACK_HOSTNAME, clientConfiguration); } else { endpoint = RuntimeHttpUtils.toUri(Constants.S3_ACCELERATE_HOSTNAME, clientConfiguration); } } request.setHttpMethod(httpMethod); resolveRequestEndpoint(request, bucketName, key, endpoint); return request; }
resolveRequestEndpoint(request, bucketName, key, RuntimeHttpUtils.toUri( RegionUtils.getRegion(region).getServiceEndpoint(S3_SERVICE_NAME), clientConfiguration));
resolveRequestEndpoint(request, bucketName, key, RuntimeHttpUtils.toUri(RegionUtils.getRegion(region).getServiceEndpoint(S3_SERVICE_NAME), clientConfiguration)); return updateSigV4SignerWithRegion((AWSS3V4Signer) signer, region); } else if (request.getOriginalRequest() instanceof GeneratePresignedUrlRequest) {