HTTP状态码300(多项选择)的确切响应结构是什么? [英] What is the exact response structure for HTTP status code 300 (Multiple Choices)?

查看:674
本文介绍了HTTP状态码300(多项选择)的确切响应结构是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户单击指向我的网站http://mysite.com/some-drawing上图形的链接时, 我希望服务器以状态码300和两个资源位置(http://mysite.com/some-drawing.pnghttp://mysite.com/some-drawing.myapp)作为响应,并让客户端浏览器根据其功能自动决定使用哪个:

When a user clicks a link to a drawing on my site http://mysite.com/some-drawing, I would like my server to respond with status code 300 and two resource locations: http://mysite.com/some-drawing.png and http://mysite.com/some-drawing.myapp, and have the client browser decide automatically which one to use, based on its capabilities:

  • 如果在用户计算机上安装了MyApp,则浏览器应下载*.myapp版本并使用MyApp进行显示.

  • If MyApp is installed on the user's machine, then the browser should download the *.myapp version and use MyApp to display it.

但是,如果未安装MyApp,并且浏览器无法显示此版本,那么我希望它选择*.png版本.

However, if MyApp is not installed, and the browser is incapable to display this version, then I would like it to pick the *.png version.

但是,我很难确定状态码为300的HTTP响应的结构.

However, I am having a hard time figuring out the structure of a HTTP response with status code 300.

rfc2616 说:

所请求的资源对应于一组 代表,每个代表都有自己的特定位置,以及代理- 提供驱动的协商信息(第12节),以便 用户(或用户代理)可以选择首选的表示形式, 将其请求重定向到该位置.

The requested resource corresponds to any one of a set of representations, each with its own specific location, and agent- driven negotiation information (section 12) is being provided so that the user (or user agent) can select a preferred representation and redirect its request to that location.

除非是HEAD请求,否则响应应包含一个实体 包含来自以下位置的资源特征和位置的列表 用户或用户代理可以选择最合适的一种.这 实体格式是由Content-中指定的媒体类型指定的 输入标题字段.取决于格式和功能 用户代理,最合适的选择可能是 自动执行.但是,此规范未定义 这种自动选择的任何标准.

Unless it was a HEAD request, the response SHOULD include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content- Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice MAY be performed automatically. However, this specification does not define any standard for such automatic selection.

如果服务器有首选的表示形式,则应 在位置中包含该表示形式的特定URI 场地;用户代理可以使用位置"字段值自动 重定向.除非另有说明,否则此响应是可缓存的.

If the server has a preferred choice of representation, it SHOULD include the specific URI for that representation in the Location field; user agents MAY use the Location field value for automatic redirection. This response is cacheable unless indicated otherwise.

措辞"包含资源特征和位置列表的实体"似乎模棱两可.这是什么意思?有人知道这是怎么做的吗?

The wording "entity containing a list of resource characteristics and location(s)" seems ambiguous. What does it mean? Does anybody know how this is done?

推荐答案

那行不通.

多选"是通过发送超文本(HTML)内容中的链接并让 user 选择.

The "multiple choices" are done by sending the links in hypertext (HTML) content and let the user pick.

这篇关于HTTP状态码300(多项选择)的确切响应结构是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆