What is the syntax to get a Blobstore upload url from Android?

一世执手 提交于 2019-12-11 07:07:20

问题


I have Blobstore uploads working for GWT, but now I need my Android app to upload to Blobstore. I saw this post which explains how to upload once I have the URL, but it does not show getting the URL: Using Google BlobStore with an Android application

My questions are:

  1. what URL do I send the get to?
  2. what is the syntax of the get for blobstore?

Thanks


回答1:


I have it like this:

Widget.presenter.java:

uploadButton.addClickHandler(new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {
 //init action
 imageService.getBlobStoreUploadUrl(new AsyncCallback<String>() {
      @Override
      public void onFailure(Throwable caught) {
        Window.alert("Oups Error at ImageUploaderPresenter");
      }
      @Override
      public void onSuccess(String result) {
        uploadForm.setActionUpload(result);
        uploadForm.submit();
      }
    }
  });
}

ImageServiceImpl.java:

@Override
public String getBlobStoreUploadUrl() {
    //Map the UploadURL to the uploadservice which will be called by
    //submitting the FormPanel
    return blobstoreService.createUploadUrl("/imageUpload");
}


来源:https://stackoverflow.com/questions/8165993/what-is-the-syntax-to-get-a-blobstore-upload-url-from-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!