[httpcomments-client-4.5.2]--Source Analysis (HTTP entity)

Source: Internet
Author: User

HTTP messages can carry a content entity associated with the request or response. Entities can is found in some requests and in some responses, as they are. Requests the entities are referred to as entity enclosing. 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 is 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, are independent from a connection or other entity. Self-contained entities are generally repeatable. This type of entities'll is mostly used for entity enclosing HTTP requests.
Wrapping: The content is obtained from another entity.

This distinction is important to connection management when streaming out content from an HTTP response. For request entities this are created by a application and only sent using httpclient, the difference between, streamed D self-contained is of little importance. In, it's suggested to consider non-repeatable entities as streamed, and those that are repeatable as Self-conta ined.

HTTP messages can carry a content-related entity that requests and responds to. Entities can be found in a number of requests and some responses, because they are optional. A request to use an entity is called an entity enclosing request. The HTTP specification defines two kinds of entity encapsulation request methods: Post and put. The response is usually expected to include a content entity. There are exceptions to this rule, such as the response header method and 204 without content, 304 not modified, 205 reset content Response.

According to where the content originates: HttpClient distinguishes three entities,

Flow: Content is received from the stream, or dynamically generated. In particular, this category includes entities receiving responses from HTTP. Flow entities are generally not repeatable.

Contains: The content is obtained in memory, or in a way that is independent of the connection or other entity. The contained entities are usually repeatable. This type of entity will be used primarily for entity encapsulation of HTTP requests.
Packaging: The content is obtained from another entity.
This distinction is important for connection management Shireu content from an HTTP response. It is not important for an application to send only the difference between using HttpClient request entity flow and independence. In this case, it is recommended to consider a non repeatable entity as a stream, and those that are repeatable as independent.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.