更新时间:2023-08-17 17:37:00
对象所在空间所属用户可以执行GET操作,返回信息包括对象内容和对象的元数据信息。
GET /ObjectName?response-cache-control=ResponseCacheControl&response-content-disposition=ResponseContentDisposition&response-content-encoding=ResponseContentEncoding&response-content-language=ResponseContentLanguage&response-content-type=ResponseContentType&response-expires=ResponseExpires HTTP/1.1
Host: Bucket.Endpoint
Date: date
Authorization: authorization
GET操作获取对象内容时,允许用户通过请求参数的方式对一些消息头进行重写,可以重写的消息头有:Content-Type、Expires、Content-language、Cache-Control、Content-Disposition、Content-Encoding。
参数名称 | 描述 | 是否必选 |
---|---|---|
response-content-type | 重写响应中的Content-Type头。不同的ContentType 会影响客户端所看到的效果.默认的ContentType为 text/html 也就是网页格式。例子:text/html;charset=utf-8 类型:字符串。 |
否 |
response-expires | 重写响应中的Expires头,浏览器缓存的过期时间。 类型:字符串。 |
否 |
response-content-language | 重写响应中的Content-Language头。 类型:字符串。 |
否 |
response-cache-control | 重写响应中的Cache-Control头。网页的缓存是由HTTP消息头中的“Cache-control”来控制的,常见的取值有private、no-cache、max-age、must-revalidate等,默认为private 类型:字符串。 |
否 |
response-content-disposition | 重写响应中的Content-Disposition头。当用户想把请求所得的内容存为一个文件的时候提供一个默认的文件名。例子:attachment; filename=“cool.html” 类型:字符串。 |
否 |
response-content-encoding | 重写响应中的Content-Encoding头。响应内容编码类型例子:gzip, deflate 类型:字符串。 |
否 |
除使用公共请求头部,还包含
参数名称 | 描述 | 是否必选 |
---|---|---|
If-Match | 如果对象的ETag和请求中指定的ETag相同,则返回对象内容,否则的话返回412(precondition failed)( not found) 类型:字符串。(ETag值,例:0f64741bf7cb1089e988e4585d0d3434) |
否 |
If-Modified-Since | 如果对象的修改时间在这个值之后,返回对象内容;否则返回304(not modified)。 类型:字符串 |
否 |
If-Unmodified-Since | 如果对象的修改时间在这个值之前,返回对象内容;否则返回412(precondition failed)) 类型:字符串。 |
否 |
If-None-Match | 如果对象的ETag和请求中指定的ETag不相同,则返回对象内容,否则的话返回304(not modified)。 类型:字符串。(ETag值,例:0f64741bf7cb1089e988e4585d0d3434) |
否 |
Range | 获取对象时获取在Range范围内的对象内容;如果Range不合法则报416 Requested Range Not Satisfiable;Range是一个范围,它的起始值最小为0,最大为对象长度减1。 类型:字符串。(bytes=byte_range例:bytes=0-4或 bytes=512-1024。) |
否 |
无
HTTP/1.1 status_code
x-wos-request-id: request id
Content-Type: type
Date: date
Content-Length: length
Etag: etag
Last-Modified: time
<Object Content>
除了使用公共响应头部,还使用以下头部
元素名称 | 描述 |
---|---|
Etag | 上传数据的Entity tag |
x-wos-storage-class | 文件的存储类型,Standard-标准存储、IA-低频存储、Archive-归档存储。默认同空间的存储类型 |
x-amz-meta-* | 自定义元数据 |
无
GET /test HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/1
Host: bucket.s3-cn-east-1.wcsapi.com
Accept: */*
Date: Sat, 03 Dec 2011 08:28:02 +0000
Authorization: WOS BF6C09F302931425E9A7:tQ+A280jUgPCAdSTuUis35T9gWI=
HTTP/1.1 200 OK
x-wos-request-id: 001B21A61C6C0000013403098535528C
x-wos-storage-class: Standard
ETag: "507e3fff69b69bf57d303e807448560b"
Last-Modified: Sat, 03 Dec 2011 08:25:46 GMT
Accept-Ranges: bytes
Content-Length: 30
Content-Type: binary/octet-stream
Date: Sat, 03 Dec 2011 08:28:02 GMT
[30 bytes of object data]