错误继承模块:gwt中的Windows azure blobstore而不是GAE Blobstore

时间:2013-12-17 20:44:39

标签: windows gwt azure blobstore gwt-platform

我在gwt中使用了Windows Azure SDK for java,并在gwt中获得了这个问题:

No source code is available for type com.microsoft.windowsazure.services.core.storage.CloudStorageAccount; did you forget to inherit a required module?

任何想法?,例如<inherits name ="....."/>

的正确值

这是代码,但问题不在于代码,是继承名称的正确值:

public class StorageSmple {

    public static final String storageConnectionString = 
            "DefaultEndpointsProtocol=http;" + 
               "AccountName=xxxxxx;" + 
               "AccountKey=xxxxxxx"; 

    public void executeProgram()
    {
        try
        {
            CloudStorageAccount account;
            CloudBlobClient serviceClient;
            CloudBlobContainer container;
            CloudBlockBlob blob;

            account = CloudStorageAccount.parse(storageConnectionString);
            serviceClient = account.createCloudBlobClient();
            // Container name must be lower case.
            container = serviceClient.getContainerReference("gettingstarted");
            container.createIfNotExist();

            // Set anonymous access on the container.
            BlobContainerPermissions containerPermissions;
            containerPermissions = new BlobContainerPermissions();
            containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
            container.uploadPermissions(containerPermissions);

            // Upload an image file.
            blob = container.getBlockBlobReference("image");
            File fileReference = new File ("www.xxx/a254.png");
            blob.upload(new FileInputStream(fileReference), fileReference.length());

            // At this point the image is uploaded.
            // Next, create an HTML page that lists all of the uploaded images.
            MakeHTMLPage(container);

            System.out.println("Processing complete.");
            System.out.println("Open index.html to see the images stored in your storage account.");

        }catch (Exception e){
            System.out.print("Exception encountered: ");
            System.out.println(e.getMessage());
        }
    }

    // Create an HTML page that can be used to display the uploaded images.
    // This example assumes all of the blobs are for images.
    public  void MakeHTMLPage(CloudBlobContainer container) throws FileNotFoundException, URISyntaxException
{


        // Enumerate the uploaded blobs.
        for (ListBlobItem blobItem : container.listBlobs()) {
             HTMLPanel b = new HTMLPanel("<img src='" + blobItem.getUri() + "'/><br/>");
             RootPanel.get().add(b);
        }

    }
}

1 个答案:

答案 0 :(得分:0)

我对Azure不太熟悉,但我非常怀疑Azure Java SDK是否会在服务器端使用。此SDK中必须存在未由GWT模拟的代码。

任何尚未由GWT模拟的代码(有关模拟类列表,请参阅here)必须附带GWT可翻译源(请参阅<super-source/> here)。