I just migrated to HRD and now its telling me i cant access my own blobs...
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)
I stored the keys as a string inside the datastore entities and then i create them like this:
BlobKey key = new BlobKey(this.params.blobKey);
How can i recover the blobs?
I found a solution:
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.
来源:https://stackoverflow.com/questions/10458931/how-can-i-recover-blobs-after-migration-to-hrd