@Override public HttpUriRequest getRedirect(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException { if(response.containsHeader("x-amz-bucket-region")) { final String host = ((HttpUriRequest) request).getURI().getHost(); if(!StringUtils.equals(session.getHost().getHostname(), host)) { regionEndpointCache.putRegionForBucketName( StringUtils.split(StringUtils.removeEnd(((HttpUriRequest) request).getURI().getHost(), session.getHost().getHostname()), ".")[0], response.getFirstHeader("x-amz-bucket-region").getValue()); } } return super.getRedirect(request, response, context); } });
/** * Constructs the service and initialises the properties. * * @param credentials the S3 user credentials to use when communicating with S3, may be null in which case the * communication is done as an anonymous user. * @param invokingApplicationDescription a short description of the application using the service, suitable for inclusion in a * user agent string for REST/HTTP requests. Ideally this would include the application's * version number, for example: <code>Cockpit/0.7.3</code> or <code>My App Name/1.0</code> * @param credentialsProvider an implementation of the HttpClient CredentialsProvider interface, to provide a means for * prompting for credentials when necessary. * @param jets3tProperties JetS3t properties that will be applied within this service. */ public RestStorageService(ProviderCredentials credentials, String invokingApplicationDescription, CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties) { super(credentials, invokingApplicationDescription, jets3tProperties); this.credentialsProvider = credentialsProvider; this.defaultStorageClass = getJetS3tProperties().getStringProperty( "s3service.default-storage-class", null); this.defaultServerSideEncryptionAlgorithm = getJetS3tProperties().getStringProperty( "s3service.server-side-encryption", null); this.regionEndpointCache = new RegionEndpointCache(); }
&& this.regionEndpointCache.containsRegionForBucketName( requestBucketName))) this.regionEndpointCache.putRegionForBucketName( requestBucketName, region); region = this.regionEndpointCache.getRegionForBucketName( requestBucketName);
if(session.getClient().getRegionEndpointCache().containsRegionForBucketName(containerService.getContainer(file).getName())) { region = session.getClient().getRegionEndpointCache() .getRegionForBucketName(containerService.getContainer(file).getName());
final String bucket = containerService.getContainer(file).getName(); session.getClient().deleteBucket(bucket); session.getClient().getRegionEndpointCache().removeRegionForBucketName(bucket);
&& this.regionEndpointCache.containsRegionForBucketName( requestBucketName))) this.regionEndpointCache.putRegionForBucketName( requestBucketName, region); region = this.regionEndpointCache.getRegionForBucketName( requestBucketName);
final String bucket = containerService.getContainer(file).getName(); session.getClient().deleteBucket(bucket); session.getClient().getRegionEndpointCache().removeRegionForBucketName(bucket);
return unknown; if(cache.containsRegionForBucketName(container.getName())) { return new S3Region(cache.getRegionForBucketName(container.getName())); cache.putRegionForBucketName(container.getName(), region.getIdentifier()); return region;
String bucketName = ServiceUtils.findBucketNameInHostOrPath( originalURI, this.getEndpoint()); this.regionEndpointCache.putRegionForBucketName( bucketName, expectedRegion);
/** * Constructs the service and initialises the properties. * * @param credentials the S3 user credentials to use when communicating with S3, may be null in which case the * communication is done as an anonymous user. * @param invokingApplicationDescription a short description of the application using the service, suitable for inclusion in a * user agent string for REST/HTTP requests. Ideally this would include the application's * version number, for example: <code>Cockpit/0.7.3</code> or <code>My App Name/1.0</code> * @param credentialsProvider an implementation of the HttpClient CredentialsProvider interface, to provide a means for * prompting for credentials when necessary. * @param jets3tProperties JetS3t properties that will be applied within this service. */ public RestStorageService(ProviderCredentials credentials, String invokingApplicationDescription, CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties) { super(credentials, invokingApplicationDescription, jets3tProperties); this.credentialsProvider = credentialsProvider; this.defaultStorageClass = getJetS3tProperties().getStringProperty( "s3service.default-storage-class", null); this.defaultServerSideEncryptionAlgorithm = getJetS3tProperties().getStringProperty( "s3service.server-side-encryption", null); this.regionEndpointCache = new RegionEndpointCache(); }
String bucketName = ServiceUtils.findBucketNameInHostOrPath( originalURI, this.getEndpoint()); this.regionEndpointCache.putRegionForBucketName( bucketName, expectedRegion);