@Test public void testGetOrigin() { final S3Session session = new S3Session(new Host(new S3Protocol(), new S3Protocol().getDefaultHostname())); final CloudFrontDistributionConfiguration configuration = new WebsiteCloudFrontDistributionConfiguration( session, new DisabledX509TrustManager(), new DefaultX509KeyManager(), Collections.emptyMap() ); assertEquals("bbb.s3.amazonaws.com", configuration.getOrigin(new Path("/bbb", EnumSet.of(Path.Type.directory, Path.Type.volume)), Distribution.DOWNLOAD).getHost()); assertEquals("bbb.s3.amazonaws.com", configuration.getOrigin(new Path("/bbb", EnumSet.of(Path.Type.directory, Path.Type.volume)), Distribution.WEBSITE).getHost()); final Path container = new Path("/bbb", EnumSet.of(Path.Type.directory, Path.Type.volume)); container.attributes().setRegion("US"); assertEquals("bbb.s3-website-us-east-1.amazonaws.com", configuration.getOrigin(container, Distribution.WEBSITE_CDN).getHost()); container.attributes().setRegion("us-west-2"); assertEquals("bbb.s3-website-us-west-2.amazonaws.com", configuration.getOrigin(container, Distribution.WEBSITE_CDN).getHost()); }
@Override protected URI getOrigin(final Path container, final Distribution.Method method) { if(method.equals(Distribution.WEBSITE_CDN)) { return URI.create(String.format("http: } return super.getOrigin(container, method); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override protected URI getOrigin(final Path container, final Distribution.Method method) { if(method.equals(Distribution.WEBSITE_CDN)) { return URI.create(String.format("http: } return super.getOrigin(container, method); } }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override protected URI getOrigin(final Path container, final Distribution.Method method) { if(method.equals(Distribution.WEBSITE_CDN)) { return URI.create(String.format("http: } return super.getOrigin(container, method); } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override protected URI getOrigin(final Path container, final Distribution.Method method) { if(method.equals(Distribution.WEBSITE_CDN)) { return URI.create(String.format("http: } return super.getOrigin(container, method); } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(final Distribution.Method method); @Override Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt); @Override void write(final Path container, final Distribution distribution, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override protected URI getOrigin(final Path container, final Distribution.Method method) { if(method.equals(Distribution.WEBSITE_CDN)) { return URI.create(String.format("http: } return super.getOrigin(container, method); } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(final Distribution.Method method); @Override Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt); @Override void write(final Path container, final Distribution distribution, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method);  }