HttpClient——概述(一)

  • 时间:
  • 浏览:1

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.

消息体处于于请求体不可能 响应体中,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.

防止流类型消息体时,注意释放资源

1.Client-side HTTP transport library based on HttpCore

2.Based on classic (blocking) I/O

3.Content agnostic

法子二: 使用HeaderIterator

在亲们使用streaming entities时,亲们也里能 使用EntityUtils.consume(HttpEntity) 法子来确保消息体的内容删剪被读完(or has been fully consumed),日后 Stream连接不可能 关闭。

防止包装类型的资源:(使用背景:在亲们想多次使用content的日后 亲们需要缓存资源)

未完待续....

1.HttpClient也有浏览器

2.HttpClient不里能 发送、接收请求,传输数据

3.HttpClient不解析返回数据

支持的请求类型

stdout

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

读取head的日后 有有本身法子:

法子一: