[httpcomments-client-4.5.2]--源码分析( HTTP entity)
来源:互联网 发布:朝勇投资有限公司 知乎 编辑:程序博客网 时间:2024/05/16 15:20
HTTP messages can carry a content entity associated with the request or response. Entities can be found in some requests and in some responses, as they are optional. Requests that use entities are referred to as entity enclosing requests. The HTTP specification defines two entity enclosing request methods: POST and PUT. Responses are usually expected to enclose a content entity. There are exceptions to this rule such as responses to HEAD method and 204 No Content, 304 Not Modified, 205 Reset Content responses.
HttpClient distinguishes three kinds of entities, depending on where their content originates:
streamed: The content is received from a stream, or generated on the fly. In particular, this category includes entities being received from HTTP responses. Streamed entities are generally not repeatable.
self-contained: The content is in memory or obtained by means that are independent from a connection or other entity. Self-contained entities are generally repeatable. This type of entities will be mostly used for entity enclosing HTTP requests.
wrapping: The content is obtained from another entity.
This distinction is important for connection management when streaming out content from an HTTP response. For request entities that are created by an application and only sent using HttpClient, the difference between streamed and self-contained is of little importance. In that case, it is suggested to consider non-repeatable entities as streamed, and those that are repeatable as self-contained.
HTTP消息可以携带一个请求和响应的内容关联实体。实体可以在一些请求和一些响应中找到,因为它们是可选的。使用实体的请求被称为实体封闭请求。HTTP规范定义了两种实体封装请求方法:POST和PUT。响应通常预计将包含一个内容实体。有此规则的异常,如响应头方法和204没有内容,304没有修改,205复位内容响应。
根据其内容来源于哪里: HttpClient区分三种实体,
流:内容是从流接收,或动态生成的。特别是,这一类包括实体接收从HTTP响应。流实体一般不可重复。
包含:该内容是在内存中,或通过与连接或其他实体独立的方式获得的。包含的实体通常是可重复的。这种类型的实体将主要用于实体封装HTTP请求。
包装:内容是从另一个实体获得的。
这种区别对于连接管理时流出来的内容从一个HTTP响应是很重要的。这是由一个应用只发送使用HttpClient请求实体流和独立之间的差异并不重要。在这种情况下,建议考虑非可重复的实体作为流,和那些是可重复的作为独立的。
- [httpcomments-client-4.5.2]--源码分析( HTTP entity)
- [httpcomments-client-4.5.2]--源码分析(HTTP request)
- [httpcomments-client-4.5.2]--源码分析(HTTP response)
- [httpcomments-client-4.5.2]--源码分析(Get请求)
- [httpcomments-client-4.5.2]--源码分析(Request execution)
- [httpcomments-client-4.5.2]--源码分析(Working with message headers)
- go HTTP Client大量长连接保持(自定义client设置及源码简单分析)
- neutron client源码分析
- zookeeper源码分析-client分析
- jetty http client 实现分析
- HBase Client Get 源码分析
- golang的http client源码简析
- 源码-spark client(2)
- client读写hdfs的源码分析总结
- Hadoop RPC源码分析之Client
- Storm-源码分析-Topology Submit-Client
- python-swiftclient client.py源码分析
- [FileZilla Client 源码分析二]CCommandQueue类
- a:visited为何一直起作用
- 同步,阻塞
- 越狱及蠕虫病毒
- 2016 ICPC 大连网络赛 HDU 5874 Friends and Enemies
- javascript网页特效——div的应用
- [httpcomments-client-4.5.2]--源码分析( HTTP entity)
- 【React Native】Navigator组件 使用理解-转载自React Native中文社区
- curl模拟post请求提交
- ffmpeg用来播放视频
- Leetcode_14
- Java中继承讲解
- Java 中的 scanner
- SQL优化避免索引失效
- Mybatis中tinyint(1)数据自动转化为boolean处理