我刚刚迁移到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);
我如何恢复斑点?
答案 0 :(得分: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.