web-services - 303 响应正文中的超链接

标签 web-services http rest rfc2616

在 POST 后执行 303 重定向时,RFC 2616提到在响应正文中添加超链接(即 POST 的 303 响应正文,而不是后续 GET 对新创建资源的响应)。

10.3.4 303 See Other

The response to the request can be found under a different URI and SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response MUST NOT be cached, but the response to the second (redirected) request might be cacheable.

The different URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).

我有两个问题:

  1. 是否有任何实现(浏览器或其他)在 303 的正文中使用此类链接?

  2. 如果在正文中添加链接,最合适的链接关系是什么? rel="self", rel="alternate" ?两者似乎都不合适。我意识到对于这样的事情可能没有标准的链接关系,如果是这样的话,那就这样吧。

最佳答案

1) 我相信所有常见的浏览器都会显示 POST->303 的响应,尽管 GET 可能不是这种情况(参见 http://greenbytes.de/tech/tc/httpredirects/#t303body)

关于web-services - 303 响应正文中的超链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12042376/

相关文章:

web-services - 是否有支持相互身份验证的免费/公共(public)网络服务?

c - 使用 C 中的简单 HTTP 服务器支持 gzip/zip 文件压缩

http - 我在 chrome 开发者工具中看到响应正文,但无法在前端检索它

django - 如何在 Django-rest-auth 中验证请求?

java - Java/Spring中接收POST请求并获取JSON元素

javascript - 使用 JS 消耗 JSON 时出错

java - 从 Angular Js(Java Web)调用 API 时出现 CORS 错误

asp.net - 具有 DEV、QA 和 PROD 版本的 WCF 服务

web-services - 无法使用 java 读取 SharePoint 列表

java - 有没有办法在终端中执行包含单个单词(或短语)的 jar 文件?