0
votes

I have a java app engine program that will read File upload into Blob and then using File API for blobKey and use it for ImageAPI getServing Url.

So the current steps are: 1. File upload using Angular JS or other clients 2. Servlet read the file and transform it into Blob 3. File API convert the Blob into blobKey 4. Image API will then return the image url that the calling client will get.

The new BlobStore documents: https://cloud.google.com/appengine/docs/java/blobstore/

It suggest us to use JSP and action="<%= blobstoreService.createUploadUrl("/upload") %>"

However, I can't do that as most of my calling client are AngularJS based and none JSP based.

Has anyone implemented something that can be without JSP? Like the following.

  1. AngularJS client upload image and wait for the url as return
  2. servlet receive the request and convert it to blobKey (no more FILE API)
  3. Image api return the URL

Much appreciated.

1
you can call blobstoreService.createUploadUrl from a servlet as well, or anything executed on server side - Igor Artamonov
Thx Igor. I wasn't sure how to pass the POST data back to createUploadUrl. I actually created a forward post methods and it works now. Thanks! - Fooger

1 Answers

0
votes

If you are using AngularJS you should consider having a dedicated endpoint to get the upload URL and include that in your form commit URL. With that URL you can either commit the form with the blobs or send the to your backend as Base64.