protected void initializeProxy() { // Retrieve Proxy settings. if(getJetS3tProperties().getBoolProperty("httpclient.proxy-autodetect", true)) { RestUtils.initHttpProxy(httpClient, getJetS3tProperties(), this.getEndpoint()); } else { String proxyHostAddress = getJetS3tProperties().getStringProperty("httpclient.proxy-host", null); int proxyPort = getJetS3tProperties().getIntProperty("httpclient.proxy-port", -1); String proxyUser = getJetS3tProperties().getStringProperty("httpclient.proxy-user", null); String proxyPassword = getJetS3tProperties().getStringProperty("httpclient.proxy-password", null); String proxyDomain = getJetS3tProperties().getStringProperty("httpclient.proxy-domain", null); RestUtils.initHttpProxy(httpClient, getJetS3tProperties(), false, proxyHostAddress, proxyPort, proxyUser, proxyPassword, proxyDomain, this.getEndpoint()); } }
protected void initializeProxy() { // Retrieve Proxy settings. if(getJetS3tProperties().getBoolProperty("httpclient.proxy-autodetect", true)) { RestUtils.initHttpProxy(httpClient, getJetS3tProperties(), this.getEndpoint()); } else { String proxyHostAddress = getJetS3tProperties().getStringProperty("httpclient.proxy-host", null); int proxyPort = getJetS3tProperties().getIntProperty("httpclient.proxy-port", -1); String proxyUser = getJetS3tProperties().getStringProperty("httpclient.proxy-user", null); String proxyPassword = getJetS3tProperties().getStringProperty("httpclient.proxy-password", null); String proxyDomain = getJetS3tProperties().getStringProperty("httpclient.proxy-domain", null); RestUtils.initHttpProxy(httpClient, getJetS3tProperties(), false, proxyHostAddress, proxyPort, proxyUser, proxyPassword, proxyDomain, this.getEndpoint()); } }
protected boolean isLiveMD5HashingRequired(StorageObject object) { // We do not need to calculate the data MD5 hash during upload if the // expected hash value was provided as the object's Content-MD5 header. if(object.getMetadata(StorageObject.METADATA_HEADER_CONTENT_MD5) != null) { return false; } boolean disableLiveMd5 = getJetS3tProperties().getBoolProperty( "storage-service.disable-live-md5", false); return !disableLiveMd5; }
/** * 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(); }
protected boolean isLiveMD5HashingRequired(StorageObject object) { // We do not need to calculate the data MD5 hash during upload if the // expected hash value was provided as the object's Content-MD5 header. if(object.getMetadata(StorageObject.METADATA_HEADER_CONTENT_MD5) != null) { return false; } boolean disableLiveMd5 = getJetS3tProperties().getBoolProperty( "storage-service.disable-live-md5", false); return !disableLiveMd5; }
/** * 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(); }
/** * Initialise HttpClient and HttpConnectionManager objects with the configuration settings * appropriate for communicating with S3. By default, this method simply delegates the * configuration task to {@link org.jets3t.service.utils.RestUtils#initHttpConnection(JetS3tRequestAuthorizer, org.jets3t.service.Jets3tProperties, String, org.apache.http.client.CredentialsProvider)}. * <p> * To alter the low-level behaviour of the HttpClient library, override this method in * a subclass and apply your own settings before returning the objects. * * @return configured HttpClient library client and connection manager objects. */ protected HttpClient initHttpConnection() { return RestUtils.initHttpConnection( this, getJetS3tProperties(), getInvokingApplicationDescription(), getCredentialsProvider()); }
/** * Initialise HttpClient and HttpConnectionManager objects with the configuration settings * appropriate for communicating with S3. By default, this method simply delegates the * configuration task to {@link org.jets3t.service.utils.RestUtils#initHttpConnection(JetS3tRequestAuthorizer, org.jets3t.service.Jets3tProperties, String, org.apache.http.client.CredentialsProvider)}. * <p> * To alter the low-level behaviour of the HttpClient library, override this method in * a subclass and apply your own settings before returning the objects. * * @return configured HttpClient library client and connection manager objects. */ protected HttpClient initHttpConnection() { return RestUtils.initHttpConnection( this, getJetS3tProperties(), getInvokingApplicationDescription(), getCredentialsProvider()); }
int retryMaxCount = getJetS3tProperties().getIntProperty("httpclient.retry-max", 5);
int retryMaxCount = getJetS3tProperties().getIntProperty("httpclient.retry-max", 5);
object.getContentType(), object.getContentLength(), getJetS3tProperties(), isLiveMD5HashingRequired(object));
object.getContentType(), object.getContentLength(), getJetS3tProperties(), isLiveMD5HashingRequired(object));
String requestSignatureVersion = this.getJetS3tProperties() .getStringProperty( "storage-service.request-signature-version", "AWS2")
String requestSignatureVersion = this.getJetS3tProperties() .getStringProperty( "storage-service.request-signature-version", "AWS2")
repeatableRequestEntity = new RepeatableRequestEntity(object.getKey(), object.getDataInputStream(), object.getContentType(), object.getContentLength(), getJetS3tProperties(), isLiveMD5HashingRequired);
repeatableRequestEntity = new RepeatableRequestEntity(object.getKey(), object.getDataInputStream(), object.getContentType(), object.getContentLength(), getJetS3tProperties(), isLiveMD5HashingRequired);