0
Google App Engine에서 REST 웹 서비스 (Jersey 사용)에 이미지를 업로드하려고합니다.REST 웹 서비스에서 Blobstore에 예외 액세스
이 내 방법 :
@POST
@Path("/upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadImage(@Context HttpServletRequest request){
BlobstoreService bs = BlobstoreServiceFactory.getBlobstoreService();
bs.createUploadUrl("/upload");
Map<String, List<BlobKey>> blobFields = bs.getUploads(request);
List<BlobKey> blobKeys = blobFields.entrySet().iterator().next().getValue();
if (blobKeys != null && !blobKeys.isEmpty()) {
BlobKey blobKey = blobKeys.get(0);
System.out.println("MY KEY: "+blobKey.getKeyString());
}
return null;
}
하지만 난이 예외 얻을 :이 라인에
Uncaught exception from servlet
java.lang.IllegalStateException: Must be called from a blob upload callback request.
을 :
내가 틀렸다Map<String, List<BlobKey>> blobFields = bs.getUploads(request);
?