hostAndBucket = ServiceUtils.generateS3HostnameForBucket( userBucketName, disableDnsBuckets, s3Endpoint);
hostAndBucket = ServiceUtils.generateS3HostnameForBucket( userBucketName, disableDnsBuckets, s3Endpoint);
/** * Generates a URL string that will return a Torrent file for an object in S3, * which file can be downloaded and run in a BitTorrent client. * * @param bucket the name of the bucket containing the object. * @param key the name of the object. * @return a URL to a Torrent file representing the object. */ public String create(final String bucket, final String key) { String s3Endpoint = endpoint.getHostname(); String serviceEndpointVirtualPath = ""; String bucketNameInPath = ServiceUtils.isBucketNameValidDNSName(bucket) ? "" : RestUtils.encodeUrlString(bucket) + "/"; String urlPath = RestUtils.encodeUrlPath(serviceEndpointVirtualPath, "/") + "/" + bucketNameInPath + RestUtils.encodeUrlPath(key, "/"); return "http://" + ServiceUtils.generateS3HostnameForBucket( bucket, false, s3Endpoint) + urlPath + "?torrent"; } }
: ServiceUtils.generateS3HostnameForBucket( bucketName, isDnsBucketNamingDisabled, s3Endpoint));
String hostname = ServiceUtils.generateS3HostnameForBucket( bucketName, disableDnsBuckets, endPoint);
: ServiceUtils.generateS3HostnameForBucket( bucketName, isDnsBucketNamingDisabled, s3Endpoint));
String hostname = ServiceUtils.generateS3HostnameForBucket( bucketName, disableDnsBuckets, endPoint);
protected UpdateStreamingDistributionResult updateStreamingDistribution(final Path container, final Distribution distribution) throws BackgroundException { final URI origin = this.getOrigin(container, distribution.getMethod()); if(log.isDebugEnabled()) { log.debug(String.format("Update %s distribution with origin %s", distribution.getMethod().toString(), origin)); } final AmazonCloudFront client = client(container); final GetStreamingDistributionConfigResult response = client.getStreamingDistributionConfig(new GetStreamingDistributionConfigRequest(distribution.getId())); final StreamingDistributionConfig config = response.getStreamingDistributionConfig() .withEnabled(distribution.isEnabled()) .withS3Origin(new S3Origin(origin.getHost(), StringUtils.EMPTY)) .withAliases(new Aliases().withItems(distribution.getCNAMEs()).withQuantity(distribution.getCNAMEs().length)); if(distribution.isLogging()) { // Make bucket name fully qualified final String loggingTarget = ServiceUtils.generateS3HostnameForBucket(distribution.getLoggingContainer(), false, new S3Protocol().getDefaultHostname()); if(log.isDebugEnabled()) { log.debug(String.format("Set logging target for %s to %s", distribution, loggingTarget)); } config.setLogging(new StreamingLoggingConfig() .withEnabled(distribution.isLogging()) .withBucket(loggingTarget) .withPrefix(preferences.getProperty("cloudfront.logging.prefix")) ); } return client.updateStreamingDistribution(new UpdateStreamingDistributionRequest(config, distribution.getId(), response.getETag())); }
.withAliases(new Aliases().withItems(distribution.getCNAMEs()).withQuantity(distribution.getCNAMEs().length)); final String loggingTarget = ServiceUtils.generateS3HostnameForBucket(distribution.getLoggingContainer(), false, new S3Protocol().getDefaultHostname()); if(log.isDebugEnabled()) {
+ "/" + bucketNameInPath + RestUtils.encodeUrlPath(objectKey, "/"); return "http://" + ServiceUtils.generateS3HostnameForBucket( bucketName, disableDnsBuckets, s3Endpoint) + (httpPort != 80 ? ":" + httpPort : "")
protected UpdateDistributionResult updateCustomDistribution(final Path container, final Distribution distribution) throws BackgroundException { final URI origin = this.getOrigin(container, distribution.getMethod()); if(log.isDebugEnabled()) { log.debug(String.format("Update %s distribution with origin %s", distribution.getMethod().toString(), origin)); } final AmazonCloudFront client = client(container); final GetDistributionConfigResult response = client.getDistributionConfig(new GetDistributionConfigRequest(distribution.getId())); final DistributionConfig config = response.getDistributionConfig() .withEnabled(distribution.isEnabled()) .withDefaultRootObject(distribution.getIndexDocument() != null ? distribution.getIndexDocument() : StringUtils.EMPTY) .withAliases(new Aliases().withItems(distribution.getCNAMEs()).withQuantity(distribution.getCNAMEs().length)); // Make bucket name fully qualified final String loggingTarget = ServiceUtils.generateS3HostnameForBucket(distribution.getLoggingContainer(), false, new S3Protocol().getDefaultHostname()); if(log.isDebugEnabled()) { log.debug(String.format("Set logging target for %s to %s", distribution, loggingTarget)); } config.setLogging(new LoggingConfig() .withEnabled(distribution.isLogging()) .withIncludeCookies(true) .withBucket(loggingTarget) .withPrefix(preferences.getProperty("cloudfront.logging.prefix")) ); return client.updateDistribution(new UpdateDistributionRequest(config, distribution.getId(), response.getETag())); }
+ "/" + bucketNameInPath + RestUtils.encodeUrlPath(objectKey, "/"); return "http://" + ServiceUtils.generateS3HostnameForBucket( bucketName, disableDnsBuckets, s3Endpoint) + (httpPort != 80 ? ":" + httpPort : "")
if(distribution.isLogging()) { final String loggingTarget = ServiceUtils.generateS3HostnameForBucket(distribution.getLoggingContainer(), false, new S3Protocol().getDefaultHostname()); if(log.isDebugEnabled()) {
if(distribution.isLogging()) { final String loggingTarget = ServiceUtils.generateS3HostnameForBucket(distribution.getLoggingContainer(), false, new S3Protocol().getDefaultHostname()); if(log.isDebugEnabled()) {
.withAliases(new Aliases().withItems(distribution.getCNAMEs()).withQuantity(distribution.getCNAMEs().length)); final String loggingTarget = ServiceUtils.generateS3HostnameForBucket(distribution.getLoggingContainer(), false, new S3Protocol().getDefaultHostname()); if(log.isDebugEnabled()) {