Package | Description |
---|---|
org.dromara.hutool.http.client |
HTTP请求客户端封装,请求过程如下:
Server
^ |
| v
Request Response
^ |
| v
ClientEngine
|
org.dromara.hutool.http.client.body |
请求体封装实现
|
org.dromara.hutool.http.client.engine.httpclient4 |
Apache HttpClient 4.x实现
文档见:https://hc.apache.org/httpcomponents-client-4.5.x/index.html |
org.dromara.hutool.http.client.engine.httpclient5 |
Apache HttpClient 5.1.x实现
文档见:https://hc.apache.org/httpcomponents-client-5.1.x/index.html |
org.dromara.hutool.http.client.engine.okhttp |
OKHttp3封装
文档见:https://square.github.io/okhttp/ |
Modifier and Type | Method and Description |
---|---|
HttpBody |
Request.body()
获取请求体
|
HttpBody |
Request.handledBody()
获取处理过的请求体,即如果是非REST的GET请求,始终返回
null |
Modifier and Type | Method and Description |
---|---|
Request |
Request.body(HttpBody body)
添加请求体
|
Modifier and Type | Class and Description |
---|---|
class |
BytesBody
bytes类型的Http request body,主要发送编码后的表单数据或rest body(如JSON或XML)
|
class |
FormBody<T extends FormBody<T>>
Form表单形式的消息体
|
class |
MultipartBody
Multipart/form-data数据的请求体封装
遵循RFC2387规范,见:https://www.rfc-editor.org/rfc/rfc2387 |
class |
ResourceBody
Resource 类型的Http request body,主要发送资源文件中的内容 |
class |
ResponseBody
响应体部分封装
|
class |
StringBody
String类型的body,一般用于Rest请求的请求体,如JSON或XML
|
class |
UrlEncodedFormBody
application/x-www-form-urlencoded 类型请求body封装
|
Constructor and Description |
---|
HttpClient4BodyEntity(String contentType,
String contentEncoding,
boolean chunked,
HttpBody body)
构造
|
Constructor and Description |
---|
HttpClient5BodyEntity(String contentType,
String contentEncoding,
boolean chunked,
HttpBody body)
构造
|
Constructor and Description |
---|
OkHttpRequestBody(HttpBody body)
构造
|
Copyright © 2025. All rights reserved.