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); 

どうすればblobを回復できますか?

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 に答える