import com.microsoft.windowsazure.services.core.storage.*; import com.microsoft.windowsazure.services.blob.client.*;
public static final String storageConnectionString = "DefaultEndpointsProtocol=http;" + "AccountName=[yourAccount];" + "AccountKey=[yourKey]"; String storageConnectionString = RoleEnvironment.getConfigurationSettings().get("StorageConnectionString");
<%@ page import="com.microsoft.windowsazure.services.core.storage.*" %> <%@ page import="com.microsoft.windowsazure.services.blob.client.*" %> <html> <head> <title>ThaiCreate.Com Azure Tutorial</title> </head> <body> <% String storageConnectionString = "DefaultEndpointsProtocol=http;" + "AccountName=[yourAccount];" + "AccountKey=[yourKey]"; CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString); // Create the blob client CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); // The container name CloudBlobContainer container1 = blobClient.getContainerReference("pictures"); container1.createIfNotExist(); // The container name CloudBlobContainer container2 = blobClient.getContainerReference("movies"); container2.createIfNotExist(); // Create a permissions object BlobContainerPermissions containerPermissions = new BlobContainerPermissions(); // Include public access in the permissions object containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER); // Set the permissions on the container container1.uploadPermissions(containerPermissions); container2.uploadPermissions(containerPermissions); out.print("Container 'pictures' and 'movies' created."); %> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท