Package org.jets3t.service.model

Examples of org.jets3t.service.model.S3WebsiteConfig


            if (name.equals("Suffix")) {
                this.indexDocumentSuffix = elementText;
            } else if (name.equals("Key")) {
                this.errorDocumentKey = elementText;
            } else if (name.equals("WebsiteConfiguration")) {
                this.websiteConfig = new S3WebsiteConfig(
                    indexDocumentSuffix, errorDocumentKey);
            }
        }
View Full Code Here


                assertEquals(404, e.getResponseCode());
            }

            // Set index document
            s3Service.setWebsiteConfig(bucketName,
                new S3WebsiteConfig("index.html"));

            Thread.sleep(5000);

            // Confirm index document set
            S3WebsiteConfig config = s3Service.getWebsiteConfig(bucketName);
            assertTrue(config.isWebsiteConfigActive());
            assertEquals("index.html", config.getIndexDocumentSuffix());
            assertNull(config.getErrorDocumentKey());

            // Upload public index document
            S3Object indexObject = new S3Object("index.html", "index.html contents");
            indexObject.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
            s3Service.putObject(bucketName, indexObject);

            // Confirm index document is served at explicit path
            getMethod = new HttpGet(s3WebsiteURL + "/index.html");
            HttpResponse response = httpClient.execute(getMethod);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertEquals("index.html contents", EntityUtils.toString(response.getEntity()));

            // Confirm index document is served at root path
            // (i.e. website config is effective)
            getMethod = new HttpGet(s3WebsiteURL + "/");
            response = httpClient.execute(getMethod);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertEquals("index.html contents", EntityUtils.toString(response.getEntity()));

            // Set index document and error document
            s3Service.setWebsiteConfig(bucketName,
                new S3WebsiteConfig("index.html", "error.html"));

            Thread.sleep(10000)// Config updates can take a long time... ugh!

            // Confirm index document and error document set
            config = s3Service.getWebsiteConfig(bucketName);
            assertTrue(config.isWebsiteConfigActive());
            assertEquals("index.html", config.getIndexDocumentSuffix());
            assertEquals("error.html", config.getErrorDocumentKey());

            // Upload public error document
            S3Object errorObject = new S3Object("error.html", "error.html contents");
            errorObject.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
            s3Service.putObject(bucketName, errorObject);
View Full Code Here

TOP

Related Classes of org.jets3t.service.model.S3WebsiteConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.