Class RestS3Service

All Implemented Interfaces:
AWSRequestAuthorizer, SignedUrlHandler

public class RestS3Service extends S3Service
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
  • Constructor Details

    • RestS3Service

      public RestS3Service(ProviderCredentials credentials) throws S3ServiceException
      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 or My 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 or My 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 or My 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

      public void setDevPayUserToken(String userToken)
      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

      public String 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

      public void setDevPayProductToken(String productToken)
      Set the Product Token value to use for requests to a DevPay S3 account.
      Parameters:
      productToken - the token that identifies your DevPay product.
    • getDevPayProductToken

      public String 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 setting httpclient.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 setting httpclient.requester-pays-buckets-enabled.
      Returns:
      true if S3 service requests will include the Requester Pays flag, false otherwise.
    • getEndpoint

      public String getEndpoint()
      Specified by:
      getEndpoint in class StorageService
      Returns:
      the endpoint to be used to connect to S3.
    • getRestHeaderPrefix

      public String getRestHeaderPrefix()
      Specified by:
      getRestHeaderPrefix in class StorageService
      Returns:
      header prefix for general Amazon headers: x-amz-.
    • getResourceParameterNames

      public List<String> getResourceParameterNames()
      Specified by:
      getResourceParameterNames in class StorageService
      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

      public String getRestMetadataPrefix()
      Specified by:
      getRestMetadataPrefix in class StorageService
      Returns:
      header prefix for Amazon metadata headers: x-amz-meta-.