简体   繁体   English

如何获取Google Blobstore中二进制文件的直接url?

[英]How to get the direct url of a binary file in the Google Blobstore?

My application generates binary data (compressed xml) and saves it to the Google App Engine Blobstore.我的应用程序生成二进制数据(压缩的 xml)并将其保存到 Google App Engine Blobstore。 I want to return a public URL that clients can use to access this binary file from anywhere, without needing to go through AppEngine and my Java servlets. I know it's possible to get this kind of URL for images using ImagesService#getServingUrl , but what about for other types of files?我想返回一个公共的 URL,客户端可以使用它从任何地方访问这个二进制文件,而不需要通过 AppEngine 和我的 go 和我的 Java servlets。我知道可以使用ImagesService#getServingUr为图像获得这种 881657866602088,但是关于什么对于其他类型的文件?

I create my file like this:我这样创建我的文件:

FileService#createNewBlobFile("application/octet-stream", "myfile.bin");

When I call AppEngineFile#getFullPath() I get something like:当我调用 AppEngineFile#getFullPath() 时,我得到如下信息:

/blobstore/writable:a2c0noo4_LNQ0mS6wFdCMA

I can see the file created in my dev filesystem with a different random name.我可以看到在我的开发文件系统中创建的文件具有不同的随机名称。 What's its URL?它的 URL 是什么?

You can use Google Cloud Storage for your file.您可以为您的文件使用 Google Cloud Storage。

You can then provide a public cloud storage URL for you file that will allow you clients to download it without going through AppEngine.然后,您可以为您的文件提供公共云存储 URL,这将允许您的客户无需通过 AppEngine 即可下载它。 There are a whole lot of different ACL scenarios you can use to tighten down the access as well, it's in the docs.您也可以使用许多不同的 ACL 方案来加强访问,它在文档中。

Using Google Cloud Storage with the Files API. 使用谷歌云存储文件 API。

Cloud Storage Docs. 云存储文档。

According to the docs, there's no public URL for objects in the blobstore.根据文档,blobstore 中的对象没有公共 URL。 You can only access it through the Blobstore API from your app.您只能从您的应用程序通过 Blobstore API 访问它。 So if you want your blobstore objects to each have a URL, you'd have to create your own handler for that, which of course will have to pass through AppEngine and your Java servlets.因此,如果您希望每个 blobstore 对象都有一个 URL,您必须为此创建自己的处理程序,这当然必须通过 AppEngine 和您的 Java servlets。

I think the ImagesService#getServingUrl doesn't generate a Public URL for the images in blobstore.我认为ImagesService#getServingUrl不会为 blobstore 中的图像生成 Public URL。 That URL doesn't really point directly to your blobstore data. URL 并没有真正直接指向您的 blobstore 数据。 It points to an image service that is able to access your blobstore, and serves your image for you through its own high performance infrastructure.它指向一个能够访问您的 blobstore 的图像服务,并通过其自身的高性能基础设施为您提供图像服务。

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

相关问题 如何获取通过 Node.js 上传的多部分文件的直接 URL - How to get direct URL to multipart file uploaded via Node.js Bigquery - 谷歌身份验证不直接到 url - Bigquery - google auth does not direct to url 上传文件到 blobstore 数据存储 - upload file to blobstore data store 如何获取带有上传文件令牌的 url 到 firebase 存储? - How do I get url with token of uploaded file to firebase storage? 如何使用 GAE/J 将所有数据存储 Blob 移动到 blobstore? - How to move all datastore Blobs to blobstore with GAE/J? 将文件上传到 Firebase 后如何获取文件 URL? - How to get file URL after uploading them to Firebase? 我可以获得我的 Google Cloud Functions 的根 URL 吗? - Can I get root URL to my Google Cloud Function? 从图像的公共 URL 获取 Google Cloud Storage 对象 - Get Google Cloud Storage object from Public URL of an image 如何获取cargo run的二进制output<rust.rs> ?</rust.rs> - How to get the binary output of cargo run <rust.rs>? 我如何直接在基于服务器的应用程序中使用谷歌云物联网数据? - How can i use the Google Cloud IoT data direct in the server based app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM