Mistake
Called: java.lang.IllegalStateException: must be called from blob to load the callback request. in com.google.appengine.api.blobstore.BlobstoreServiceImpl.getUploads (BlobstoreServiceImpl.java:169)
the code
public class UserUploadProfilePictureResource extends ServerResource { @Post public void handleBlobstoreUpload(Representation entity) { Representation rep =null; if (entity !=null) { if (MediaType.MULTIPART_FORM_DATA.equals(entity.getMediaType(), true)) { Request restletRequest = getRequest(); HttpServletRequest servletRequest = ServletUtils.getRequest(restletRequest); BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); Map<String, List<BlobKey>> blobs = blobstoreService.getUploads(servletRequest);
possible solution (but I do not want)
At first. I do not want to call the second HttpServlet.
Secondly. Regarding these messages, there is a solution to manually write the file:
- how to load a downloaded file in the form of blocks in a servlet using the Google ad mechanism
- Upload the image to a Google mobile device with Java software
Google says the following:
Deprecated: the file API feature used here to write files to Blobstore will be removed in the future, in favor of writing files to Google Cloud Storage and using Blobstore to serve them.
Possible Solution2 (but only the concept of a workaround)
http://www.cloudave.com/1055/the-new-google-app-engine-blobstore-api-first-thoughts/
Bret Slatkin notes that when the API processes the POST URL used to upload files, it creates a unique one-time URL that mitigates any potential sniffing.
This is ideal for a scenario when you create a web form for user submission. But, it makes things harder if you're trying to provide a REST API that allows you to upload files (think of, for example, TwitPic). In this case, you will have to write your own render that simulates what the web form will do (get the files, create a random POST URL, call it, ...)
Question
What is the best approach for storing images in the google engine? Is there a better way than blobstore? How to save images in a block store?
java google-app-engine file file-upload blobstore
masterchris_99
source share