title: Configure path-style in Java SDK Amazon S3
body: <p>I'm using <a href="http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/index.html" rel="noreferrer">AWS Java SDK</a> provided by Amazon to interact with the S3 service.</p>
  
  <p>It seems that by default, the SDK uses virtual-host-style for buckets (i.e. buckets are reffered by <em>bucket-name</em>.s3.amazonaws.com. Example:</p>
  
  <pre><code>PUT / HTTP/1.1
  Host: a-given-bucket.s3.amazonaws.com
  Date: Tue, 26 Jun 2012 10:39:40 GMT
  Content-Type: application/x-www-form-urlencoded; charset=utf-8
  Content-Length: 0
  </code></pre>
  
  <p>However, I need to use path-style in my application, as follows:</p>
  
  <pre><code>PUT /a-given-bucket/ HTTP/1.1
  Host: s3.amazonaws.com
  Date: Thu, 21 Jun 2012 16:27:32 GMT
  Content-Type: application/x-www-form-urlencoded; charset=utf-8
  Content-Length: 0
  </code></pre>
  
  <p>Is it possible to use path-style with the Java SDK, please? In positive case, how can I do it? I have look at ClientConfiguration and AmazonS3Client classes but I don't see any method to do it...</p>
  
  <p>My SDK version, in the case it matters, is: 2.0.0v201206151133.</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>Fermín</p>
  
  <p>PD. Some headers have been omitted in the samples for the sake of simplicity.</p>
  
  <p><strong>EDIT:</strong>
  Such a feature (to configure the URL path style used by the AmazonS3Client) is quite useful in case you have buckets with a dot (".") in them. HTTPS requests with Virtual-host-style do not work, see <a href="http://shlomoswidler.com/2009/08/amazon-s3-gotcha-using-virtual-host.html" rel="noreferrer">this</a> and <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html" rel="noreferrer">this</a>.</p>