我正在尝试通过 Blob 提供 zip 文件,存储在 GCS 中。但我收到此错误“严重:找不到 blob:BlobKey:encoded_gs_key:XYZ”
我还尝试了此链接中的给定代码,以确保我对对象具有正确的 ACL,并且我能够成功运行此代码:https ://developers.google.com/appengine/docs/java/googlecloudstorageclient/migrate
java.io.PrintWriter out = resp.getWriter( );
out.println("before");
try{
GcsFilename fileName = getFileName();
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
out.println("after");
BlobKey blobKey = blobstoreService.createGsBlobKey(
"/gs/"+ fileName.getBucketName() + "/" + fileName.getObjectName());
out.println("before");
out.println(blobKey);
blobstoreService.serve(blobKey, resp);
}
catch(Exception e){
out.println(e.getMessage());
}
resp.setContentType("application/zip");
resp.getWriter().println("Hello, world Blob");
}
private GcsFilename getFileName() {
String bucketname = "androidbucket";
String filename = "test.zip";
return new GcsFilename(bucketname, filename);
}
帮帮我!任何帮助表示赞赏!