简体   繁体   中英

Uploading files to Google App Engine using Java without a web interface

I'm attempting to write an application for Google App Engine using Java. Part of what I'd like to do is allow a user to select a file using a Swing interface which then gets uploaded to GAE. Every example and tutorial I found seems to indicate that a web interface is required, but that's something I'd rather avoid.

I appreciate the question is quite vague and I haven't specified a particular storage method (such as datastore or blob) because I'm unsure what would be more appropriate given this scenario. My main focus here would be to remove the need for web browser involvement.

Could somebody point me in the right direction? I imagine this must be doable, but I haven't been able to find anything relevant. I'm not after an obvious example or anything like that, but a starting point or a brief description of how this concept would function would be massively appreciated.

The appengine-maven-plugin for GAE is actually constructing a command line call to the GAE SDK, as you can see here . This is IMHO the Python version of the commands.

However reading the GAE documentation , you should be able to use com.google.appengine.tools.admin.AppCfg in appengine-java-sdk/lib/appengine-tools-api.jar instead. And from that code, I am quite sure one does not want to code this yourself.

I have used GAE to upload file from iOS client to GCS. I documented it in this blog http://narup.blogspot.com/2014/11/uploading-to-google-cloud-storage-from.html since lot of people were looking for it. I am sure you can do something similar on servlet side and use java http client to make a POST request

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM