有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Google云存储、blobstoreService、gzip压缩

我有一个appengine服务,可以从云存储下载文件。 我通过appengine处理特定的访问权限。 所以我使用blobstoreService来提供文件:

blobstoreService.serve(blobstoreService.createGsBlobKey("bucket" + "filepath"))

我想利用浏览器的解压功能。所以我在gzip文件上设置了元数据“Content Encoding:gzip”。但当我通过appengine下载文件时,元数据不会被考虑,文件也不会被解压缩。 如果我使用云存储api,头被正确设置,文件被浏览器解压缩

有没有办法让blobstoreService起作用


共 (1) 个答案

  1. # 1 楼答案

    我认为谷歌存储无法压缩或解压对象。 https://cloud.google.com/storage/docs/xml-api/reference-headers?csw=1#contentencoding

    Content-Encoding

    A request and response header that specifies the compression algorithm for an object.

    Valid Values: Any valid compression algorithm (see the specification).

    Example: Content-Encoding: gzip

    Details: Cloud Storage does not compress or decompress objects. If you use this header to specify a compression type algorithm (for example, deflate), Cloud Storage preserves the header but does not compress or decompress the object.