I'm working on an Appengine application in Java that allows users to upload images drawn through an HTML5 canvas library called PaintWeb (http://code.google.com/p/paintweb/).
Currently I have a servlet that receives the XMLHttpRequest POST from the paintweb javascript library as a formencoded image.
Paintweb.js library sends XMLHttpRequest POST
send = 'dataURL=' + encodeURIComponent(ev.dataURL), headers = {'Content-Type': 'application/x-www-form-urlencoded'};
A custom servlet decodes the form encoded image data as a blob and stores that in the Datastore with an associated Drawing entity
Custom servlet serves the Blob's in the datastore as ContentType("image/png") I'm curious if I can use the new BlobstoreService and ImageService features to upload my HTML5 canvas images and serve them as pure Blobs (as shown in this tutorial GWT BlobstoreService and ImageService)
According to the documentation (http://code.google.com/appengine/docs/java/blobstore/overview.html#Uploading_a_Blob) it seems like the major stopping point is that I need to POST a form with:
<input type="file" name="myFile">
Which I don't think is possible from Paintweb. Possibly a work around would be if there was some way on the server side to store a blob in the Blobstorage (instead of the datastore) so that you could reap the benefits of not using your CPU quota to serve images.
Is it possible or even a good idea to use the Appengine URL Fetch service and forward the image blob upload to the Blobstorage "createUploadURL()" from the server side.
http://code.google.com/appengine/docs/java/urlfetch/usingjavanet.html
It seems like it could be possible, but not sure it would save me resources in the long run (the images are simple small drawings that could be viewed many many more times than the upload time so I feel like I'd get benefit storing/serving from the BlobstoreService.