GAE - 谷歌云存储 - 上传错误503

时间:2012-10-24 22:00:41

标签: java google-app-engine jsp servlets google-cloud-storage

我在jsp中获得了以下代码

<%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>
<%@ page import="com.google.appengine.api.blobstore.BlobstoreService" %>
<%@ page import="com.google.appengine.api.blobstore.UploadOptions" %>
<%
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();

String uploadUrl = blobstoreService.createUploadUrl("/test.jsp", UploadOptions.Builder.withGoogleStorageBucketName("my_bucket"));

%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Upload Page</title>
</head>
<body>
    <h1>Upload v1</h1>
    <form name="form1" id="form1" action="<% out.print(uploadUrl); %>" method="post" enctype="multipart/form-data" target="upload_iframe">
    <input type="hidden" name="hiddenfield1" value="ok">
    Files to upload:
    <br/>
    <input type="file" name="myFile">
    <br/>
        <button type="submit">Send</button>
    </form>
    <iframe id="upload_iframe" name="upload_iframe"></iframe>

</body>

</html>

我也把我的桶设置为公开阅读:

python c:\gsutil\gsutil setacl public-read gs://my_bucket

我的ACL文件如下所示:

<?xml version="1.0" ?>
<AccessControlList>
    <Owner>
        <ID>00b4903a97dfaa16aff41eeb91e90b5fb524f1daf0d88fceca29b6f647412e8d</ID>
    </Owner>
    <Entries>
        <Entry>
            <Scope type="GroupById">
                <ID>00b4903a97dfaa16aff41eeb91e90b5fb524f1daf0d88fceca29b6f647412e8d</ID>
            </Scope>
            <Permission>FULL_CONTROL</Permission>
        </Entry>
        <Entry>
            <Scope type="GroupById">
                <ID>00b4903a97d3721750cd84cf5e8be336cba9847dba5c2e4a1e88aa514db970d2</ID>
            </Scope>
            <Permission>FULL_CONTROL</Permission>
        </Entry>
        <Entry>
            <Scope type="GroupById">
                <ID>00b4903a97c265aa840305b07236a7ea78681916c9e63ab74c0deb237f60f05e</ID>
            </Scope>
            <Permission>READ</Permission>
        </Entry>

<Entry>
   <Scope type="UserByEmail">
      <EmailAddress>
         my_app@appspot.gserviceaccount.com
      </EmailAddress>
   </Scope>
   <Permission>
      WRITE
   </Permission>
 </Entry>

    </Entries>
</AccessControlList>

现在每次上传我都会收到错误:503 Service Unavailable

1 个答案:

答案 0 :(得分:0)

好的,我终于解决了,

错误是这样做的:

python c:\gsutil\gsutil setacl public-read gs://my_bucket

实际上删除了acl文件,因此删除了my_app @ ...权限:/