Class RestS3Service
java.lang.Object
org.jets3t.service.StorageService
org.jets3t.service.impl.rest.httpclient.RestStorageService
org.jets3t.service.S3Service
org.jets3t.service.impl.rest.httpclient.RestS3Service
- All Implemented Interfaces:
AWSRequestAuthorizer
,SignedUrlHandler
REST/HTTP implementation of an S3Service based on the
HttpClient library.
This class uses properties obtained through Jets3tProperties
. For more information on
these properties please refer to
JetS3t Configuration
- Author:
- James Murty
-
Field Summary
Fields inherited from class org.jets3t.service.StorageService
BUCKET_STATUS__ALREADY_CLAIMED, BUCKET_STATUS__DOES_NOT_EXIST, BUCKET_STATUS__MY_BUCKET
-
Constructor Summary
ConstructorsConstructorDescriptionRestS3Service
(ProviderCredentials credentials) Constructs the service and initialises the properties.RestS3Service
(ProviderCredentials credentials, String invokingApplicationDescription, org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider) Constructs the service and initialises the properties.RestS3Service
(ProviderCredentials credentials, String invokingApplicationDescription, org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties) Constructs the service and initialises the properties.RestS3Service
(ProviderCredentials credentials, String invokingApplicationDescription, org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties, org.apache.commons.httpclient.HostConfiguration hostConfig) Constructs the service and initialises the properties. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Is this service configured to generate Requester Pays requests when uploading data to S3, or retrieving data from the service.void
setDevPayProductToken
(String productToken) Set the Product Token value to use for requests to a DevPay S3 account.void
setDevPayUserToken
(String userToken) Set the User Token value to use for requests to a DevPay S3 account.void
setRequesterPaysEnabled
(boolean isRequesterPays) Instruct the service whether to generate Requester Pays requests when uploading data to S3, or retrieving data from the service.Methods inherited from class org.jets3t.service.S3Service
buildPostForm, buildPostForm, buildPostForm, copyVersionedObject, copyVersionedObject, createBucket, createBucket, createBucket, createBucket, createSignedDeleteUrl, createSignedDeleteUrl, createSignedDeleteUrl, createSignedDeleteUrl, createSignedGetUrl, createSignedGetUrl, createSignedGetUrl, createSignedGetUrl, createSignedHeadUrl, createSignedHeadUrl, createSignedHeadUrl, createSignedHeadUrl, createSignedPutUrl, createSignedPutUrl, createSignedPutUrl, createSignedPutUrl, createSignedUrl, createSignedUrl, createSignedUrl, createSignedUrl, createSignedUrl, createSignedUrl, createTorrentUrl, createUnsignedObjectUrl, deleteBucket, deleteBucketPolicy, deleteObject, deleteVersionedObject, deleteVersionedObjectWithMFA, deleteWebsiteConfig, disableMFAForVersionedBucket, enableBucketVersioning, enableBucketVersioningAndMFA, enableBucketVersioningWithMFA, generatePostPolicyCondition, generatePostPolicyCondition_AllowAnyValue, generatePostPolicyCondition_Equality, generatePostPolicyCondition_Equality, generatePostPolicyCondition_Equality, generatePostPolicyCondition_Range, getAWSCredentials, getBucket, getBucketAcl, getBucketLocation, getBucketLoggingStatus, getBucketPolicy, getBucketVersioningStatus, getNotificationConfig, getObject, getObject, getObject, getObject, getObjectAcl, getObjectDetails, getObjectDetails, getObjectVersions, getOrCreateBucket, getOrCreateBucket, getVersionedObject, getVersionedObject, getVersionedObject, getVersionedObjectAcl, getVersionedObjectAcl, getVersionedObjectDetails, getVersionedObjectDetails, getVersionedObjectDetails, getWebsiteConfig, isRequesterPaysBucket, listAllBuckets, listObjects, listObjects, listObjects, listObjects, listObjects, listObjects, listVersionedObjects, listVersionedObjectsChunked, multipartAbortUpload, multipartCompleteUpload, multipartCompleteUpload, multipartListParts, multipartListUploads, multipartListUploads, multipartStartUpload, multipartStartUpload, multipartStartUpload, multipartUploadPart, putObject, putObject, putObjectAcl, putObjectAcl, putObjectMaybeAsMultipart, putVersionedObjectAcl, putVersionedObjectAcl, setBucketLoggingStatus, setBucketPolicy, setNotificationConfig, setRequesterPaysBucket, setWebsiteConfig, suspendBucketVersioning, suspendBucketVersioningWithMFA, unsetNotificationConfig
Methods inherited from class org.jets3t.service.impl.rest.httpclient.RestStorageService
authorizeHttpRequest, checkBucketStatus, deleteObjectWithSignedUrl, getCredentialsProvider, getHttpClient, getHttpConnectionManager, getObjectAclWithSignedUrl, getObjectDetailsWithSignedUrl, getObjectWithSignedUrl, isBucketAccessible, putObjectAclWithSignedUrl, putObjectWithSignedUrl, setCredentialsProvider, setHttpClient, setHttpConnectionManager
Methods inherited from class org.jets3t.service.StorageService
copyObject, copyObject, createBucket, deleteBucket, deleteBucket, deleteObject, getAccountOwner, getBucketAcl, getCurrentTimeWithOffset, getInternalErrorRetryMax, getInvokingApplicationDescription, getJetS3tProperties, getObjectAcl, getObjectDetails, getObjectDetails, getProviderCredentials, isAuthenticatedConnection, isHttpsOnly, isObjectInBucket, isShutdown, listObjectsChunked, listObjectsChunked, moveObject, putBucketAcl, putBucketAcl, putObject, putObjectAcl, putObjectAcl, renameMetadataKeys, renameObject, shutdown, updateObjectMetadata
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jets3t.service.utils.signedurl.SignedUrlHandler
deleteObjectWithSignedUrl, getObjectAclWithSignedUrl, getObjectDetailsWithSignedUrl, getObjectWithSignedUrl, putObjectAclWithSignedUrl, putObjectWithSignedUrl
-
Constructor Details
-
RestS3Service
Constructs the service and initialises the properties.- Parameters:
credentials
- the user credentials to use when communicating with S3, may be null in which case the communication is done as an anonymous user.- Throws:
S3ServiceException
-
RestS3Service
public RestS3Service(ProviderCredentials credentials, String invokingApplicationDescription, org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider) throws S3ServiceException Constructs the service and initialises the properties.- Parameters:
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.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:Cockpit/0.7.3
orMy App Name/1.0
credentialsProvider
- an implementation of the HttpClient CredentialsProvider interface, to provide a means for prompting for credentials when necessary.- Throws:
S3ServiceException
-
RestS3Service
public RestS3Service(ProviderCredentials credentials, String invokingApplicationDescription, org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties) throws S3ServiceException Constructs the service and initialises the properties.- Parameters:
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.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:Cockpit/0.7.3
orMy App Name/1.0
credentialsProvider
- an implementation of the HttpClient CredentialsProvider interface, to provide a means for prompting for credentials when necessary.jets3tProperties
- JetS3t properties that will be applied within this service.- Throws:
S3ServiceException
-
RestS3Service
public RestS3Service(ProviderCredentials credentials, String invokingApplicationDescription, org.apache.commons.httpclient.auth.CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties, org.apache.commons.httpclient.HostConfiguration hostConfig) throws S3ServiceException Constructs the service and initialises the properties.- Parameters:
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.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:Cockpit/0.7.3
orMy App Name/1.0
credentialsProvider
- an implementation of the HttpClient CredentialsProvider interface, to provide a means for prompting for credentials when necessary.jets3tProperties
- JetS3t properties that will be applied within this service.hostConfig
- Custom HTTP host configuration; e.g to register a custom Protocol Socket Factory- Throws:
S3ServiceException
-
-
Method Details
-
setDevPayUserToken
Set the User Token value to use for requests to a DevPay S3 account. The user token is not required for DevPay web products for which the user token was created after 15th May 2008.- Parameters:
userToken
- the user token value provided by the AWS DevPay activation service.
-
getDevPayUserToken
- Returns:
- the user token value to use in requests to a DevPay S3 account, or null if no such token value has been set.
-
setDevPayProductToken
Set the Product Token value to use for requests to a DevPay S3 account.- Parameters:
productToken
- the token that identifies your DevPay product.
-
getDevPayProductToken
- Returns:
- the product token value to use in requests to a DevPay S3 account, or null if no such token value has been set.
-
setRequesterPaysEnabled
public void setRequesterPaysEnabled(boolean isRequesterPays) Instruct the service whether to generate Requester Pays requests when uploading data to S3, or retrieving data from the service. The default value for the Requester Pays Enabled setting is set according to the jets3t.properties settinghttpclient.requester-pays-buckets-enabled
.- Parameters:
isRequesterPays
- if true, all subsequent S3 service requests will include the Requester Pays flag.
-
isRequesterPaysEnabled
public boolean isRequesterPaysEnabled()Is this service configured to generate Requester Pays requests when uploading data to S3, or retrieving data from the service. The default value for the Requester Pays Enabled setting is set according to the jets3t.properties settinghttpclient.requester-pays-buckets-enabled
.- Returns:
- true if S3 service requests will include the Requester Pays flag, false otherwise.
-
getEndpoint
- Specified by:
getEndpoint
in classStorageService
- Returns:
- the endpoint to be used to connect to S3.
-
getRestHeaderPrefix
- Specified by:
getRestHeaderPrefix
in classStorageService
- Returns:
- header prefix for general Amazon headers: x-amz-.
-
getResourceParameterNames
- Specified by:
getResourceParameterNames
in classStorageService
- Returns:
- GET parameter names that represent specific resources in the target service, as opposed to representing REST operation "plumbing". For example the "acl" parameter might be used to represent a resource's access control list settings.
-
getRestMetadataPrefix
- Specified by:
getRestMetadataPrefix
in classStorageService
- Returns:
- header prefix for Amazon metadata headers: x-amz-meta-.
-