0

我在我的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

4

1 回答 1

0

好的,我终于解决了,

错误是这样做的:

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

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

于 2012-10-24T23:02:47.030 回答