简体   繁体   English

使用Java在没有网络界面的情况下将文件上传到Google App Engine

[英]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. 我正在尝试使用Java为Google App Engine编写应用程序。 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. 我想做的部分工作是允许用户使用Swing界面选择文件,然后将其上传到GAE。 Every example and tutorial I found seems to indicate that a web interface is required, but that's something I'd rather avoid. 我发现的每个示例和教程似乎都表明需要Web界面,但是我宁愿避免这种情况。

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. 我知道问题很模糊,而且我没有指定特定的存储方法(例如数据存储或Blob),因为我不确定在这种情况下哪种方法更合适。 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 . 您可以在此处看到,用于GAE的appengine-maven-plugin实际上正在构建对GAE SDK的命令行调用。 This is IMHO the Python version of the commands. 这是命令的Python版本,恕我直言。

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. 不过,请阅读GAE文档 ,您应该可以改用appengine-java-sdk/lib/appengine-tools-api.jar com.google.appengine.tools.admin.AppCfg 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. 我已经使用GAE将文件从iOS客户端上传到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. 我在此博客http://narup.blogspot.com/2014/11/uploading-to-google-cloud-storage-from.html中进行了记录,因为很多人都在寻找它。 I am sure you can do something similar on servlet side and use java http client to make a POST request 我确定您可以在Servlet端执行类似的操作,并使用Java http客户端发出POST请求

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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