I have an application that allows users to save blobs in blobstore. I have a circuit that does this now, but I'm interested in something simpler and less twisted. For context, imagine my app allows users to upload an image of an animal with a paragraph describing what the animal does.
Current scheme
User calls my endpoint api, to preserve paragraphand nameanimal facility Animal. Note. The object Animalactually has 4 fields ( name, paragraph, BlobKeyand blobServingUrlas a String). But the api endpoint only allows you to save the two mentioned.
Inside the endpoint method, on the application side, after saving nameand paragraphI make the next call to generate the blob servant URL, which my endpoint method returns to the caller
@ApiMethod (name = "saveAnimalData", httpMethod = HttpMethod.POST) public String saveAnimalData (request AnimalData) throws an exception {... BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService (); String url = blobstoreService.createUploadUrl ("/ upload"); return url; }
On the Android side, I use a regular HTTP call to send the byte [] of the image to the blobstore. I am using apache DefaultHttpClient(). Note: blobstore, after saving the image, calls my application server with the blob key and serving URL
I read the answer from blobstore (blobstore called my callback) using a regular Java servlet, i.e. public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException. From the servlet, I placed BlobKeyit blobServingUrlin an object Animalfor a related animal. (I passed some metadata to the blobstore, which I use as markers to identify the associated animal).
Desired Scheme
That's where your answer comes in. Essential, I would like to remove the java servlet and limit my entire api to the Google endpoint. So my question is: how to use the endpoint to complete steps 3 and 4?
, saveAnimalData , paragraph name. blobstore, BlobKey blobServingUrl Animal.
java. .