java-将文件直接上传到Google Cloud Storage for GAE应用
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java-将文件直接上传到Google Cloud Storage for GAE应用,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1806字,纯文字阅读大概需要3分钟。
内容图文
![java-将文件直接上传到Google Cloud Storage for GAE应用](/upload/InfoBanner/zyjiaocheng/683/c4793e3840f242d38fcf0f7313ea3d13.jpg)
我正在考虑从Blobstore切换到Google Cloud Storage,以进行项目中的图片上传等操作(因为Google称Blobstore为“已取代”).
在Blobstore中,该多部分表单将直接提交(上传)到Blobstore,然后Blobstore将重写请求并重定向到GAE应用程序以处理BlobKey.这意味着GAE应用程序的负载很小.
是否可以通过Google Cloud Storage(GCS)实施类似的工作流程?
在Reading and Writing to Google Cloud Storage处给出的示例涉及GAE代码处理上载,读取数据并将其保存在GCS中.
类似地,为了服务(例如)上传的图像文件:似乎必须在一个人的GAE代码中实现一个处理程序才能从GCS读取并返回图像数据.
是否没有一种方法可以简单地为GCS中的资源生成URL(AFAIK AWS S3支持此URL)并从那里提供资源?
解决方法:
您可以继续使用blobstore API,但要在GCS中使用实际存储空间,这意味着相同的上传行为以及对应用程序的最小更改.
从Using the Blobstore API with Google Cloud Storage (Python)开始:
You can use the Blobstore API to store blobs in Cloud Storage instead
of storing them in Blobstore. You need to set up a bucket as described
in the 07001 documentation and specify the bucket
and filename in the 07002
gs_bucket_name parameter. In your upload handler, you need to process the returned 07003 metadata and explicitly store the
Google Cloud Storage filename needed to retrieve the blob later.
在那里也提供了完整的示例应用程序.
更新:糟糕,以上答案适用于Python环境,Java如下:
从Using the Blobstore API with Google Cloud Storage (Java):
You can use the Blobstore API to store blobs in Cloud Storage instead
of storing them in Blobstore. You need to set up a bucket as described
in the 07005 documentation and specify the bucket
and filename in the BlobstoreService 07006, specify
the bucket name in the UploadOptions parameter. In your upload
handler, you need to process the returned 07007 metadata and
explicitly store the Google Cloud Storage filename needed to retrieve
the blob later.
尚无Java的完整示例应用程序.
内容总结
以上是互联网集市为您收集整理的java-将文件直接上传到Google Cloud Storage for GAE应用全部内容,希望文章能够帮你解决java-将文件直接上传到Google Cloud Storage for GAE应用所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。