HttpEntity requestEntity = null;
if(location != null && !"US".equalsIgnoreCase(location)) {
metadata.put("Content-Type", "text/xml");
try {
CreateBucketConfiguration config = new CreateBucketConfiguration(location);
String configXml = config.toXml();
metadata.put("Content-Length", String.valueOf(configXml.length()));
requestEntity = new StringEntity(configXml, ContentType.create("text/plain", Constants.DEFAULT_ENCODING));
}
catch(ParserConfigurationException e) {
throw new ServiceException("Unable to encode CreateBucketConfiguration XML document", e);