Examples of GSWebsiteConfig


Examples of org.jets3t.service.model.GSWebsiteConfig

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

Examples of org.jets3t.service.model.GSWebsiteConfig

    protected void deleteWebsiteConfigImpl(String bucketName)
        throws ServiceException
    {
        // To remove the website configuration, you just send an empty website
        // configuration (with no MainPageSuffix and NotFoundPage elements)
        this.setWebsiteConfigImpl(bucketName,  new GSWebsiteConfig());
    }
View Full Code Here

Examples of org.jets3t.service.model.GSWebsiteConfig

            assertNull(service.getWebsiteConfig(bucketName).getErrorDocumentKey());
            assertNull(service.getWebsiteConfig(bucketName).getIndexDocumentSuffix());

            // Set index document
            service.setWebsiteConfig(bucketName,
                    new GSWebsiteConfig("index.html"));

            // Confirm index document set
            GSWebsiteConfig config = service.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);
            service.putObject(bucketName, indexObject);

            // Confirm index document is served at explicit path
            getMethod = new HttpGet(websiteURL + "/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(websiteURL + "/");
            response = httpClient.execute(getMethod);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertEquals("index.html contents", EntityUtils.toString(response.getEntity()));

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

            // Confirm index document and error document set
            config = service.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);
            service.putObject(bucketName, errorObject);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.