0

我刚刚迁移到 HRD,现在它告诉我我无法访问自己的 blob...

Uncaught exception from servlet
java.lang.SecurityException: This application does not have access to that blob.
at com.google.appengine.api.blobstore.BlobstoreServiceImpl.fetchData(BlobstoreServiceImpl.java:200)
at com.droidastic.telljokes.server.servlet.ServeBlobsServlet.checkBlobKeyExists(ServeBlobsServlet.java:100)
at com.droidastic.telljokes.server.servlet.ServeBlobsServlet.doGet(ServeBlobsServlet.java:64)

我将密钥作为字符串存储在数据存储实体中,然后像这样创建它们:

BlobKey key = new BlobKey(this.params.blobKey); 

我怎样才能恢复斑点?

4

1 回答 1

2

我找到了一个解决方案:

public String getMigratedBlobKey(String oldKey) {
  String migrationEntityKey = "__BlobMigration__";
  Key createKey = KeyFactory.createKey(migrationEntityKey, oldKey);
  Entity migrationEntity = datastore.get(createKey);
  BlobKey newKey = (BlobKey) migrationEntity.getProperty("new_blob_key");
  return newKey.getKeyString();
}

"__BlobMigration__" and "new_blob_key" are GAE constants.
于 2012-05-08T00:31:28.273 回答