HttpClient——概述(一)

  • 时间:
  • 浏览:1

在其他人使用streaming entities时,其他人也还还都可以 使用EntityUtils.consume(HttpEntity) 措施来确保消息体的内容删剪被读完(or has been fully consumed),以后 Stream连接将会关闭。

处理包装类型的资源:(使用背景:在其他人想多次使用content的以后 其他人都要缓存资源)

1.HttpClient否有浏览器

2.HttpClient必须发送、接收请求,传输数据

3.HttpClient不解析返回数据

支持的请求类型

stdout

The difference between closing the content stream and closing the response is that the former will attempt to keep the underlying connection alive by consuming the entity content while the latter immediately shuts down and discards the connection.

读取head的以后 有并否有措施:

措施一:

未完待续....

措施二: 使用HeaderIterator

HTTP request URIs consist of a protocol scheme, host name, optional port, resource path, optional query, and optional fragment.

1.Client-side HTTP transport library based on HttpCore

2.Based on classic (blocking) I/O

3.Content agnostic

stdout

消息体位于于请求体将会响应体中,HttpClient通过内容的源来区分并否有消息体:

streamed:

The content is received from a stream, or generated on the fly. Streamed entities are generally not repeatable.

self-contained:

Self-contained entities are generally repeatable, will be mostly used for entity enclosing HTTP requests

wrapping:

The content is obtained from another entity.

补充:The HTTP specification defines two entity enclosing request methods: POST and PUT.

处理流类型消息体时,注意释放资源